Skip to content

Instantly share code, notes, and snippets.

@citmusa
Created April 10, 2013 21:32
Show Gist options
  • Save citmusa/5358636 to your computer and use it in GitHub Desktop.
Save citmusa/5358636 to your computer and use it in GitHub Desktop.
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