I'm new to Apache Common vfs, Success connecting to the server I already read the docs, but I'm stuck in this code. How can I list the directory / files?
.... Session session = null; FileSystemManager fsManager = null; FileSystem fs = null; try { String host = "host_here"; int port = 22; String userStr = "user_here"; char [] username = userStr.toCharArray(); String passStr = "password_here"; char [] password = passStr.toCharArray(); session = SftpClientFactory.createConnection(host, port, username, password, null); //session.connect(); System.out.println("Connected to the server"); FileSystemOptions opts = new FileSystemOptions(); fsManager = VFS.getManager(); FileObject file = fsManager.resolveFile("ftp://"+userStr+":"+passStr+"@"+host+"/home/", opts); // .... whats next i do here? ..... } catch (Exception e) { session.disconnect(); e.printStackTrace(); } ...
Please help me, thank you earlier :)
fanjavaid
source share