ftputil - a high-level FTP client library for Python
The ftputil Python library is a high-level interface to the ftplib module. The FTPHost objects generated with ftputil allow many operations similar to those of os and os.path. Here are two examples:
# download some files from the login directory
host = ftputil.FTPHost('ftp.domain.com', 'user', 'secret')
names = host.listdir(host.curdir)
for name in names:
if host.path.isfile(name):
host.download(name, name, 'b') # remote, local, binary mode
# make a new directory and copy a remote file into it
host.mkdir('newdir')
source = host.file('index.html', 'r') # file-like object
target = host.file('newdir/index.html', 'w') # file-like object
host.copyfileobj(source, target) # similar to shutil.copyfileobj
source.close()
target.close()
Also, there's host.stat to request size and modification time of a file. Even host.walk works. :-)
On this website you find:
- Documentation (also: RussianDocumentation)
- Download page
- SourceRepository
- MailingLists (hosted by Codespeak, thanks Holger! :-) )
- IssueTracker (you can view summary lists of tickets; due to spam, entering new tickets for bugs or enhancement requests requires a login with user name ftputiluser and password ftputil)
The website is built with Trac, an open-source wiki, issue tracker and Subversion repository browser.
