Created
September 21, 2010 14:31
-
-
Save Motoma/589759 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import ftplib | |
# Connection information | |
server = 'ftp.fu-berlin.de' | |
username = 'anonymous' | |
password = 'anything' | |
# Directory and matching information | |
directory = '/pub/misc/movies/database/' | |
filematch = '*.gz' | |
# Establish the connection | |
ftp = ftplib.FTP(server) | |
ftp.login(username, password) | |
# Change to the proper directory | |
ftp.cwd(directory) | |
# Loop through matching files and download each one individually | |
for filename in ftp.nlst(filematch): | |
fhandle = open(filename, 'wb') | |
print 'Getting ' + filename | |
ftp.retrbinary('RETR ' + filename, fhandle.write) | |
fhandle.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment