* Tim Johnson <t...@akwebsoft.com> [110914 18:18]:
> * Chris Rebert <c...@rebertia.com> [110914 16:46]:
> > On Wed, Sep 14, 2011 at 12:50 PM, Tim Johnson <t...@akwebsoft.com> 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
> >
> > http://docs.python.org/library/os.path.html#os.path.getmtime
> > Your sample seems to be a typical Unix timestamp:
> Yup. Needs to be converted to a timedate stamp, methinks.
> > http://en.wikipedia.org/wiki/Unix_time
> I'll look at that tomorrow. Late here.
> > > 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)
> > http://tools.ietf.org/html/rfc3659#section-3
> >
> > (Note: Code 213 = File status response)
> and '213 20110726004703'[4:] should give me
> the string representation of the timedate stamp on the
> remote file.
FYI: datetime.datetime.fromtimestamp(mod_time)
Is probably what I was looking for. However, for my
purposes - I'm going to take another approach.
Every uploaded file is defined in an object stored on my
workstationr:
I will store the MDTM string after upload and then on the next
upload, compare the stored string with the return value
from ftp.sendcmd('MDTM ' + filename)
Thanks for the input.
--
Tim
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com
--
http://mail.python.org/mailman/listinfo/python-list