Downloading most recently modified files

Shawn Milochik Shawn at Milochik.com
Thu May 7 22:36:55 CEST 2009


On Thu, May 7, 2009 at 2:19 PM, AllenLars <allenreas at gmail.com> wrote:
>
> I am trying to code a script that will allow me to go to ftp site and
> download files based on most recently modified file (date, time).  I am
> brand new to programming.  Any and all help is appreciated.
> --<snip>


I've actually written code to do this, and it's fairly easy. Just use
the FTP module to run the "ls" (directory listing) command and parse
the results to get the filenames and timestamps. Then you will be able
to easily do download requests for the file(s) you want.

Perhaps someone else on the list can chime in with a more elegant solution.

Here's enough to get you started:

from ftplib import FTP   #(http://docs.python.org/library/ftplib.html)

ShawnMilo



More information about the Python-list mailing list