Hi,

I would like to FTP a file that only part of the filename is known.
The name is something like “ClimateData2010042207XXXX.xls”
performing the following does not work:

FTPClient client = new FTPClient();
    FileOutputStream fos = null;
    client.connect("ftp.domain.com");
    client.login("admin", "secret");
    String filename = “ClimateData2010042207*.xls”;
    fos = new FileOutputStream(filename);
    client.retrieveFile("/" + filename, fos);
    fos.close();
    client.disconnect();

Please advice,
Yair

Recommended Answers

FTP supports a mget command which can be used for retrieving multiple files based on the passed in file name/pattern. Look into your FTP client documentation for such support.

Jump to Post

All 3 Replies

FTP supports a mget command which can be used for retrieving multiple files based on the passed in file name/pattern. Look into your FTP client documentation for such support.

Thanks, finaly I have used the wget command line that doing the work.

Hi YairHa,

How do you use wget(or mget) with org.apache.commons.net.ftp.FTPClient ?

Thanks
Zen...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.