commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "pete pete" <>
Subject VFS: SftpFileObject.doListChildren
Date Tue, 04 Sep 2007 18:00:53 GMT
Hi, I'm trying to use VFS to list the files in an SFTP directory. Basically, 
this is what I'm trying:

FileSystemManager mgr = new customFileSystemManager(); // sftp provider 
FileObject fileDir = mgr.resolveFile("sftp://user:password@host/dir/");
if (fileDir.exists()) {
    FileObject[] files = fileDir.getChildren();

Now, the problem I'm having is that fileDir.getChildren() returns a 
FileObject list. However, it is trying to call 
SftpFileObject.doListChildren(), since fileDir is really an SftpFileObject 
under the hood (from what I understand). Sftp.FileObject.doListChildren() 
returns a String. So, I'm getting a casting error:

Caused by: java.lang.ClassCastException: com.jcraft.jsch.channelSftp$LsEntry

Can someone help me get around this?

Get a FREE small business Web site and more from Microsoft® Office Live!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message