ftp = FTP(host="127.0.0.1", user="u",passwd="p") ftp.cwd("/data") file_name = sorted(ftp.nlst(), key=lambda x: ftp.voidcmd(f"MDTM {x}"))[-1]