in src/main/java/com/pastdev/jsch/nio/file/UnixSshFileSystemProvider.java [163:187]
public void createDirectory( Path path, FileAttribute<?>... fileAttributes ) throws IOException {
UnixSshPath unixPath = checkPath( path );
Set<PosixFilePermission> permissions = null;
for ( FileAttribute<?> fileAttribute : fileAttributes ) {
if ( fileAttribute.name().equals( "posix:permissions" ) ) {
permissions = (Set<PosixFilePermission>)fileAttribute.value();
}
}
StringBuilder commandBuilder = new StringBuilder( unixPath.getFileSystem().getCommand( "mkdir" ) )
.append( " " );
if ( permissions != null ) {
commandBuilder.append( "-m " ).append( toMode( permissions ) );
}
commandBuilder.append( unixPath.toAbsolutePath().quotedString() );
final String command = commandBuilder.toString();
final ExecuteResult result = execute(unixPath, command);
if (result.getExitCode() != 0) {
if (exists(path)) {
throw new FileAlreadyExistsException(path.toString());
}
throw new UnixSshCommandFailedException(command, result);
}
}