[Q] ftplib: How to compare date?

C.Laurence Gonsalves clgonsal at keeshah.penguinpowered.com
Thu Feb 1 02:27:02 EST 2001


On Thu, 01 Feb 2001 05:43:33 GMT, Daehyok Shin <DSHIN at nc.rr.com> wrote:
>I like to compare the creation dates of two files using ftplib.
>But, I cannot find any function to get the date of remote files.
>How can I do it?

I don't think there's any way to do this reliably. You can try and get a
list of the directory, but different FTP servers will return the listing
in different formats. If you only want it to work on known FTP servers,
you can parse the format yourself though (string.split and time.strptime
would probably come in handy at this point).

Also, if you want to compare the time stamps of files on the local
system with the time stamps of files on a remote FTP server, be aware
that the clocks probably aren't in sync, and might not even be in the
same time zone.

-- 
  C. Laurence Gonsalves                "Any sufficiently advanced
  clgonsal at kami.com                     technology is indistinguishable
  http://cryogen.com/clgonsal/          from magic." -- Arthur C. Clarke



More information about the Python-list mailing list