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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.