OK, here it is. It is essentially the Demo.java with a few changes.
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPMessageCollector;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.FTPConnectMode;
import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger;
public class DownloadCronus {
/**
* Log stream
*/
private static Logger log = Logger.getLogger(DownloadCronus.class);
/**
* Standard main()
*
* @param args standard args
*/
public static void main(String[] args) {
// we want remote host, user name and password
if (args.length < 3) {
usage();
System.exit(1);
}
// assign args to make it clear
String host = args[0];
String user = args[1];
String password = args[2];
Logger.setLevel(Level.ALL);
FTPClient ftp = null;
try {
// set up client
ftp = new FTPClient();
ftp.setRemoteHost(host);
FTPMessageCollector listener = new FTPMessageCollector();
ftp.setMessageListener(listener);
//ftp.setAutoPassiveIPSubstitution(true);
// connect
log.info("Connecting");
ftp.connect();
// login
log.info("Logging in");
ftp.login(user, password);
// set up passive ASCII transfers
log.debug("Setting up BINARY transfers");
ftp.setType(FTPTransferType.BINARY);
ftp.setConnectMode(FTPConnectMode.ACTIVE);
ftp.setTransferBufferSize(1000);
ftp.chdir("..");
ftp.chdir("IQR");
// copy file from server
log.info("Getting file");
ftp.get("IKOB.OCT04.MATCHED");
// Shut down client
log.info("Quitting client");
ftp.quit();
String messages = listener.getLog();
log.debug("Listener log:");
log.debug(messages);
log.info("Test complete");
} catch (Exception e) {
log.error("DownloadCronus failed", e);
}
}
/**
* Basic usage statement
*/
public static void usage() {
System.out.println("Usage: DownloadCronus remotehost user password");
}
}