Entry
How do I get a file list via an ftp connection?
Jun 27th, 2000 05:46
Kenroy Harrison, unknown unknown, Thomas Weholt
Here's a sample from the FTPLIB Library Reference page:
http://www.python.org/doc/current/lib/module-ftplib.html
from ftplib import FTP
ftp = FTP('ftp.python.org') # connect to host, default port
ftp.login() # user anonymous, passwd user@hostname
ftp.retrlines('LIST') # list directory contents
ftp.quit()
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.