Change file or directory permissions.
@param path file or directory path.
@param permissions POSIX permissions.
@throws IOException in case of error.
338558
public void chmod(String path, int permissions) throws IOException {
        SFTPv3FileAttributes atts = new SFTPv3FileAttributes();
        atts.permissions = permissions;
        setstat(path, atts);
    }
247491
protected function setPath($path, $permission)
    {
        if (true !== $this->files->exists($path)) {
            $this->files->mkdir($path, $permission, true);
        }
        $this->path = $path;
    }
172084
public static void move(String srcPath, String dstPath) throws IOException {
    Files.move(Paths.get(srcPath), Paths.get(dstPath), StandardCopyOption.REPLACE_EXISTING);
  }
318705
public function setPermissionsAttribute(array $permissions = [])
    {
        foreach ($permissions as $key => $value) {
            $permissions[$key] = (bool) $value;
        }
        $this->attributes['permissions'] = json_encode($permissions ?? []);
    }
1153054
private void setRWPermissions(File f) {
    if (!f.setReadable(true, false) || !f.setWritable(true, false)) {
      LOG.info("Could not set permissions for file : "
          + f + " probably because user : " + System.getProperty("user.name")
          + " is not the owner");
    }
  }
292325
private void setPosixFilePermissions(File file, Set<?> set) {
    ZTZipReflectionUtil.invoke(setPosixFilePermissionsMethod, null, toPath(file), set);
  }
500941
public void setPaths(@Nonnull List<Path> paths) {
        ArgumentUtils.requireNonNull("paths", paths);
        this.paths = paths;
    }
242110
public void changePermissions(SftpFile file, int permissions)
			throws SftpStatusException, SshException {
		SftpFileAttributes attrs = new SftpFileAttributes(this,
				SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN);
		attrs.setPermissions(new UnsignedInteger32(permissions));
		setAttributes(file, attrs);
	}
50012
public static void deleteRecursively(Path path) throws IOException {
        if (Files.isDirectory(path)) {
            Files.list(path).forEach(file -> {
                try {
                    deleteRecursively(file);
                } catch (IOException e) {
                    throw new UncheckedIOException(e.getMessage(), e);
                }
            });
        }
        Files.delete(path);
    }
49301
public void setPaths(String paths) {
                if (paths != null && paths.trim().length() > 0) {
                        String[] pathArray = paths.split(",");
                        pathList.addAll(Arrays.asList(pathArray));
                }
        }
362236
public function mkdir($path, $permissions = null)
	{
		if ( ! $this->_is_conn())
		{
			return false;
		}

		$result = ftp_mkdir($this->_conn_id, $path);

		if ($result === false)
		{
			if ($this->_debug == true)
			{
				throw new \FtpFileAccessException('Unable to create directory');
			}
			return false;
		}

		// Set file permissions if needed
		if ($permissions !== null)
		{
			$this->chmod($path, (int) $permissions);
		}

		return true;
	}
1318053
public static synchronized void chdir(String path) {
		if (path != null) {
			rootDir = new File(getAbsolutePath(path)).getAbsolutePath();
		}
	}
1258534
@Override
  void enableTaskForCleanup(PathDeletionContext context)
         throws IOException {
    try {
      FileUtil.chmod(context.fullPath, "a+rwx", true);
    } catch(InterruptedException e) {
      LOG.warn("Interrupted while setting permissions for " + context.fullPath +
          " for deletion.");
    } catch(IOException ioe) {
      LOG.warn("Unable to change permissions of " + context.fullPath);
    }
  }
830919
public function permission(String $path, Int $type = 0755) : Bool
    {
        if( ftp_chmod($this->connect, $type, $path) )
        {
            return true;
        }
        else
        {
            throw new IOException(NULL, '$this->connect');
        }
    }
1152117
public static void delete(String path) throws IOException {
    if (!Files.deleteIfExists(Paths.get(path))) {
      throw new IOException("Failed to delete " + path);
    }
  }
1231226
public void addPermission(String path) {
        if (path == null) {
            return;
        }

        if (securityManager != null) {
            Permission permission = null;
            if( path.startsWith("jndi:") || path.startsWith("jar:jndi:") ) {
                if (!path.endsWith("/")) {
                    path = path + "/";
                }
                permission = new JndiPermission(path + "*");
                addPermission(permission);
            } else {
                if (!path.endsWith(File.separator)) {
                    permission = new FilePermission(path, "read");
                    addPermission(permission);
                    path = path + File.separator;
                }
                permission = new FilePermission(path + "-", "read");
                addPermission(permission);
            }
        }
    }
646561
private void visit_OP_SET_PERMISSIONS() throws IOException {
    visitTxId();
    v.visitStringUTF8( EditsElement.PATH);
    v.visitShort(      EditsElement.FS_PERMISSIONS);
  }