Tags: connect, directory, filefrom, filenames, files, folder, frequently, ftplib, grab, programming, python, retrbinary, server, specific, thebest

ftplib: retrbinary all files in directory

On Programmer » Python

1,910 words with 2 Comments; publish: Sat, 03 May 2008 22:39:00 GMT; (20062.50, « »)

I'm using ftplib to connect to a server, and I want to grab every file

from a specific folder. The filenames change frequently. What is the

best way to use retrbinary with wildcards(or some better option) to

transfer all files?

Thanks,

Israel

Tutor maillist - Tutor (AT) python (DOT) org

All Comments

Leave a comment...

  • 2 Comments
    • Israel Carr wrote:

      I'm using ftplib to connect to a server, and I want to grab every file

      from a specific folder. The filenames change frequently. What is the

      best way to use retrbinary with wildcards(or some better option) to

      transfer all files?

      Thanks,

      Israel

      Tutor maillist - Tutor (AT) python (DOT) org

      You can try ftpmirror.py, which is included with python.

      From

      """

      The file Tools/scripts/ftpmirror.py in the Python source distribution

      is a script that can mirror FTP sites, or portions thereof, using the

      ftplib module. It can be used as an extended example that applies this

      module.

      """

      Good luck.

      Rich

      Tutor maillist - Tutor (AT) python (DOT) org

      #1; Sat, 03 May 2008 22:40:00 GMT
    • Rich Krauter wrote:

      Israel Carr wrote:

      >>I'm using ftplib to connect to a server, and I want to grab every file

      >>from a specific folder. The filenames change frequently. What is the

      >>best way to use retrbinary with wildcards(or some better option) to

      >>transfer all files?

      >>

      >>Thanks,

      >>Israel

      >>

      >>

      >>Tutor maillist - Tutor (AT) python (DOT) org

      >>

      >>

      You can try ftpmirror.py, which is included with python.

      If you look at line 126 of ftpmirror.py you will see how it uses retrlines('LIST') to retrieve and

      parse the remote directory.

      Kent

      Tutor maillist - Tutor (AT) python (DOT) org

      #2; Sat, 03 May 2008 22:41:00 GMT