Jestem nowy za pomocą Apache Common vfs, I sukces połączyć z serwerem Już czytałem dokumenty, ale utknąłem w tym kodzie. Jak mogę wyświetlić katalog/pliki?Jak wyświetlić katalog plików/plików za pomocą Apache Common vfs
....
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();
}
...
Proszę mi pomóc, zanim Dziękuję :)
Dziękuję srinivas, Teraz używam JSCH: D Ale zastanawiam się, jak zapisać katalog (nie plik) do katalogu docelowego? – fanjavaid
Masz na myśli tworzenie nowego katalogu lub zapisanie katalogu z już niektórymi plikami? – SRy
Tak, w ten sposób. To jest możliwe? – fanjavaid