commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "s[e]th & h[o]lth" <seth.ho...@gmail.com>
Subject [commons-vfs & commons-net] Whitespaces in the name of FileObject when listing an FTP directory
Date Mon, 22 May 2006 12:26:02 GMT
Hello,

I'm trying to list an FTP directory. As far as i can see, it seems to work
well but i have a problem when i list files in a directoy.

-> The FTP server is WuFTP under linux.
-> The directory is "ftp://user:password@ftpserver/my directory":
-> It contains 3 files :
----> "ftp://user:password@ftpserver/my directory/file1"
----> "ftp://user:password@ftpserver/my directory/file2"
----> "ftp://user:password@ftpserver/my directory/file3"

My java-code is :
    FileSystemManager manager = VFS.getManager();
    FileSystemOptions options = new FileSystemOptions();
    FtpFileSystemConfigBuilder.getInstance().setPassiveMode(options, true);
    FileObject file =
manager.resolveFile("ftp://user:password@ftpserver/mydirectory",
options);
    FileObject[] children = file.getChildren();
    for(int i = 0; i < children.length; i++) {
        System.out.println(children[i].getName().toString());
    }


This code returns nothing on the screen but if i replace "my directory" with
"mydirectory" on the FTP server, the program prints the 3 files.

So, what is the problem please ?

Have i to use something like this ?
->    FTPFileEntryParserFactory factory = new FTPFileEntryParserFactory();
->    FtpFileSystemConfigBuilder.getInstance().setEntryParserFactory(options,
factory);

I can't find any example on the jakarta site...

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message