commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aclaval <acla...@dvidea.com>
Subject File with leading "-" in the fileName not found by FTPClient.ListFile(String)
Date Mon, 26 Apr 2010 13:24:05 GMT
Hi,

I'm using org.apache.commons.net.ftp.FTPClient and the method 
listFile(String) to fetch some file.
All is working fine since a long time.

But i begin to encounter file with a leading "-" in the file name. So my 
code continue to pass the filename to listFile(fileName). But i get a 
empty array in place of the correct FTPFile[].
The file with a leading "-" in the name do exist on the FTP server.
I get can it if i call a FTPClient.listFile()  ( no parameter )

The documentation says :

*Parameters:* |pathname| - The file or directory to list. Since the 
server may or  may not expand glob expressions, using them here is not 
recommended   and may well cause this method to fail.

I'm not sure about glob expression. But the "-" doest seams to have a 
special meaning.

I was using the 1.4.X version. I have test with the 2.0. The issues is 
the same.

So, is that normal ?

For now, i have wrap the FTPClient in another object, override 
listFile(String), and when i got a file with a leading "-", i use 
listFile() and parse the result. But i'm sure theire is a better way to 
do this.

Thanks in advance,

Antoine

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message