I'm writing a program that needs to download files from an FTP, I'm using ftp4j for this, but have run into a problem. I can connect to the FTP and initiate the download however after a couple of seconds I get an error.
it.sauronsoftware.ftp4j.FTPException [code=550, message= Failed to open file.]
at it.sauronsoftware.ftp4j.FTPClient.download(FTPClient.java:3479)
Here is my code:
try {
client.connect(host);
client.login("anonymous", "anonymous");
FTPFile[] list = client.list(url.getPath());
for (FTPFile f : list) {
String fileName = f.getName();
if(fileName.endsWith(".raw")){
System.out.println(fileName + " Downloading");
client.download(fileName, new java.io.File(fileName));
}
}
} catch (FTPIllegalReplyException e) {
e.printStackTrace();
} catch (FTPException e) {
e.printStackTrace();
} catch (FTPDataTransferException e) {
e.printStackTrace();
} catch (FTPListParseException e) {
e.printStackTrace();
} catch (FTPAbortedException e) {
e.printStackTrace();
}
}
I've tried various FTPs but every time. Here is an example of one of the FTPs I'm trying to access ftp://ftp.pride.ebi.ac.uk/pride/data/archive/2015/11/PXD000918