--- ftplib.py-cvs Sun Oct 24 20:39:38 2004 +++ ftplib.py Sun Oct 24 21:59:51 2004 @@ -506,2 +506,14 @@ + def mdtm(self, filename): + '''Retrieve the modification time of a file in the format YYYYMMDDHHMMSS.''' + # Note that the RFC doesn't say anything about 'MDTM' + resp = self.sendcmd('MDTM ' + filename) + if resp[:3] == '213': + s = resp[3:].strip() + # workaround for broken FTP servers returning responses + # starting with e.g. 19104... instead of 2004... + if len(s) == 15 and s[:2] == '19': + return repr(1900 + int(s[2:5])) + s[5:] + return s + def mkd(self, dirname):