List of files can be displayed by using FileObject#getChildren() method.
FileSystemOptions opts = new FileSystemOptions();
fsManager = VFS.getManager();
// List all the files in that directory.Try to give the directory path
FileObject localFileObject=fsManager.resolveFile("ftp://"+userStr+":"+passStr+"@"+host+"/home");
FileObject[] children = localFileObject.getChildren();
for ( int i = 0; i < children.length; i++ ){
System.out.println( children[ i ].getName().getBaseName() );
}
// End of List Files.
FileObject file = fsManager.resolveFile("ftp://"+userStr+":"+passStr+"@"+host+"/home/", opts);
My suggestion would be to Use JSCH framework which is best for SFTP operations. As this Apache Common VFS
inherently used this framework.The complexcity will be greatly reduced by JSCH
.