Our server is Unix server. Using jdk 1.7 and I am looking for a solution to delete files on the ftp server that are N weeks old.
Found Apache FTPClient example but this not using date to delete files:
FTPClient client = new FTPClient();
client.connect(host, port);
client.login(loginname, password);
client.deleteFile(fileNameOnServer);
client.disconnect();
I need example of how to delete files on ftp server based on date (like all file 3 weeks back).
Pseudocodish. You will have to settle on files that haven't beed modified in three weeks via FTPClient interface
for (FTPFile f : client.listFiles()) { Long t = f.getTimeStamp(); if t is more than three weeks ago delete f }