Python FTP get the most recent file by date

For those looking for a full solution for finding the latest file in a folder: MLSD If your FTP server supports MLSD command, a solution is easy: entries = list(ftp.mlsd()) entries.sort(key = lambda entry: entry[1][‘modify’], reverse = True) latest_name = entries[0][0] print(latest_name) LIST If you need to rely on an obsolete LIST command, you have … Read more