Reputation: 1632
I have no idea how to reference a file from the root directory. Currently, any path in the URI is child of the user directory. I'm trying to access /var/www with this:
sftp://user:password@host/var/www
but it's ineffective.
org.apache.commons.vfs2.FileNotFolderException: Could not list the contents of "sftp://user:***@host/var/www" because it is not a folder.
Upvotes: 2
Views: 2609
Reputation: 1632
I've found a solution.
SftpFileSystemConfigBuilder builder = SftpFileSystemConfigBuilder.getInstance();
FileSystemOptions options = new FileSystemOptions();
builder.getKnownHosts(options);
builder.setUserDirIsRoot(options, false);
builder.setTimeout(options, 5000);
FileObject directory = manager.resolveFile("sftp://user:password@host/var/www", options);
Upvotes: 3