Trying to create a simple plugin that simply connects to an ftp site, looks up the latest file and then downloads it. However, it isn\'t getting the latest file.
I\'
I see only one mistake:
FTPFile choice = null;
If the first file were the latest modified file, then the method would return null, causing a potential NullPointerException.
Change it to
FTPFile choice = files[0];
and the logic should be right.
If it still doesn't return the expected file, then most likely the file in question simply doesn't have the expected last modified date. Add something like this to the for loop in the method:
System.out.println(file.getTimestamp().getTime() + " - " + file.getName());
And look closer.