Reconciling os.path.getmtime vs ftp.sendcmd('MDTM filename')

Chris Rebert clp2 at
Thu Sep 15 02:41:51 CEST 2011

On Wed, Sep 14, 2011 at 12:50 PM, Tim Johnson <tim at> wrote:
> I have written a class that uses ftplib.FTP as the parent.
> I need to reconcile the modified time of a workstation file with
> that same filename on a remote server.
> Let's say we have a file called '400.shtml'. I get the mtime on
> my workstation by
>>> os.path.getmtime('400.shtml')
> 1311648420.0
Your sample seems to be a typical Unix timestamp:

> And I use
>>> ftp.sendcmd('MDTM 400.shtml') ## for the remote server
> '213 20110726004703'

RFC 3659 - Extensions to FTP
Sec 3. File Modification Time (MDTM)

(Note: Code 213 = File status response)

> My question is how to compare the two outputs?
> Pointers to documentation and other resources are invited.


More information about the Python-list mailing list