change pernmissions of path
10670
def chmod(path, mode):
    """"""
    import os, stat
    st = os.stat(path)
    return os.chmod(path, mode)
1255035
def mkdir(self, path):
        """"""

        resp = self._sendRequest("MKCOL", path)
        if resp.status_code != 201:
            if resp.status_code == 409:
                raise YaDiskException(409, "Part of path {} does not exists".format(path))
            elif resp.status_code == 405:
                raise YaDiskException(405, "Path {} already exists".format(path))
            else:
                raise YaDiskException(resp.status_code, resp.content)
335197
def _clean_path(path):
        """"""
        path = path.replace('"', '')
        path = path.replace("'", '')
        # Replace ~ with /home/user
        path = os.path.expanduser(path)
        # Replace environment variables
        path = os.path.expandvars(path)
        # If the path is relative, assume it is relative to the config file directory
        if not os.path.isabs(path):
            path = os.path.join(config.global_config.path, path)
        # Clean path, e.g. replace /./ with /
        path = os.path.abspath(path)
        # Eliminate symbolic links
        path = os.path.realpath(path)
        return path
289477
private function updateFilePermissions(ConnectionAdapterInterface $connection, $releasePath, $path, $pathSettings)
    {
        $path = $releasePath.'/'.$path;

        if (isset($pathSettings['permissions']) === false) {
            return false;
        }

        $permissions = FilePermissionCalculator::fromStringRepresentation(str_pad($pathSettings['permissions'], 10, '-'))->getMode();

        $recursive = false;
        if (isset($pathSettings['recursive'])) {
            $recursive = $pathSettings['recursive'];
        }

        return $connection->changePermissions($path, $permissions, $recursive);
    }
338558
public void chmod(String path, int permissions) throws IOException {
        SFTPv3FileAttributes atts = new SFTPv3FileAttributes();
        atts.permissions = permissions;
        setstat(path, atts);
    }
86648
protected function changePermission($path, $octal = 0755)
    {
        $status = false;

        if(!is_writable($path))
            chmod($path, $octal);

        if(!is_readable($path))
            chmod($path, $octal);

        if(is_readable($path) && is_writable($path))
            $status = true;

        return $status;

    }
1250143
def makedirs_perm(path, perm=None):
    
    if not os.path.exists(path):
        if perm is None:
            os.makedirs(path)
        else:
            umask = os.umask(0)
            try:
                os.makedirs(path, perm)
            finally:
                os.umask(umask)
935760
@Override
  public void setPermission(Path path, FsPermission permission) throws IOException {
    LOG.debug("setMode({},{})", path, permission.toString());
    AlluxioURI uri = new AlluxioURI(HadoopUtils.getPathWithoutScheme(path));
    SetAttributePOptions options = SetAttributePOptions.newBuilder()
        .setMode(new Mode(permission.toShort()).toProto()).setRecursive(false).build();
    try {
      mFileSystem.setAttribute(uri, options);
    } catch (AlluxioException e) {
      throw new IOException(e);
    }
  }
836871
def normalize_path(path, relative_to=os.getcwd()):

    """"""

    path = os.path.expanduser(os.path.normpath(path))

    if os.path.isabs(path):
        return path
    else:
        return join(relative_to, path)
208690
function mkdirRecursive(dir) {
  var parts = path.normalize(dir).split(path.sep);
  dir = '';
  for (var i = 0; i < parts.length; i++) {
    dir += parts[i] + path.sep;
    if (!existsSync(dir)) {
      fs.mkdirSync(dir, 0x1FD); // 0775 permissions
    }
  }
}
1262719
public static void changeLocalFilePermission(String filePath, String perms) throws IOException {
    Files.setPosixFilePermissions(Paths.get(filePath), PosixFilePermissions.fromString(perms));
  }
1131903
def change_directory(self, path, *args, **kwargs):
		
		previous_path = self.session_path()
		self.session_path(path)
		if os.path.isdir(self.full_path()) is False:
			self.session_path(previous_path)
			raise ValueError('Unable to change directory. It does not exist or is not a directory')
48290
def _apply_unix_permissions(self, request: Request, response: Response):
        '''
        '''
        files = yield from self._fetch_parent_path(request)

        if not files:
            return

        filename = posixpath.basename(request.file_path)

        for file_entry in files:
            if file_entry.name == filename and file_entry.perm:
                _logger.debug(
                    'Set chmod {} o{:o}.',
                    response.body.name, file_entry.perm
                )
                os.chmod(response.body.name, file_entry.perm)
455706
@Override
  public void setPermission(Path p, FsPermission permission
      ) throws IOException {
    FsAction user = permission.getUserAction();
    FsAction group = permission.getGroupAction();
    FsAction other = permission.getOtherAction();
    
    File f = pathToFile(p);
    
    // Fork chmod if group and other permissions are different...
    if (group != other) {
      execSetPermission(f, permission);
      return;
    }
    
    boolean rv = true;
    
    // read perms
    rv = f.setReadable(group.implies(FsAction.READ), false);
    checkReturnValue(rv, p, permission);
    if (group.implies(FsAction.READ) != user.implies(FsAction.READ)) {
      f.setReadable(user.implies(FsAction.READ), true);
      checkReturnValue(rv, p, permission);
    }

    // write perms
    rv = f.setWritable(group.implies(FsAction.WRITE), false);
    checkReturnValue(rv, p, permission);
    if (group.implies(FsAction.WRITE) != user.implies(FsAction.WRITE)) {
      f.setWritable(user.implies(FsAction.WRITE), true);
      checkReturnValue(rv, p, permission);
    }

    // exec perms
    rv = f.setExecutable(group.implies(FsAction.EXECUTE), false);
    checkReturnValue(rv, p, permission);
    if (group.implies(FsAction.EXECUTE) != user.implies(FsAction.EXECUTE)) {
      f.setExecutable(user.implies(FsAction.EXECUTE), true);
      checkReturnValue(rv, p, permission);
    }
  }
771287
public static void addPermission(Permission perm, ClassLoader loader)
  {
    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;

        envLoader.addPermission(perm);
      }
    }
  }
903705
public function getPermissionCommands($path, $permissions = array('644', '755'), $isSudo = false, $isFile = null, $changeOwner = true)
    {
        if (is_string($path)) {
            $path = array_fill(0, 2, $path);
        }
        list($chmodPath, $chownPath) = $path;

        $commands = array();
        $commands[] = $this->getChmodCommand($chmodPath, $permissions, $isSudo, $isFile);

        if ($changeOwner) {
            $chown = $this->getChownCommand($chownPath, $isSudo, false);
            if (isset($chown)) {
                $commands[] = $chown;
            }
        }
        return implode(' ' . $this->combineOperator . ' ', $commands).';';
    }
395856
public static function chmod($path, $perm)
    {

        // don't do anything under Windows
        if (FileSystem::getOsIdentifier() === self::OS_IDENTIFIER_WIN) {
            return;
        }

        // change the mode
        if (chmod($path, $perm) === false) {
            throw new \Exception(sprintf('Can\'t change mode for directory %s to %s', $path, $perm));
        }
    }