Created
April 10, 2013 21:32
-
-
Save citmusa/5358636 to your computer and use it in GitHub Desktop.
This file contains 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
from ftplib import FTP | |
import sys, os | |
# Connect | |
ftp = FTP('serverName') | |
ftp.login('user', 'password') | |
# Directory of the local files | |
root = "path/to/root/directory/" | |
for path, subdirs, files in os.walk(root): | |
for name in files: | |
fp = open(name, 'rb') # File to send | |
ftp.storbinary('STOR ' + name, fp) # Send file | |
fp.close() # Close file | |
ftp.quit() # close fpt connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment