Created
December 13, 2015 23:03
-
-
Save auselen/e0899dc9b0897157b63f to your computer and use it in GitHub Desktop.
Simple ftp upload client using ftplib
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
import os | |
import sys | |
from ftplib import FTP | |
# python ftpput.py [server] [dir_on_server] [local_dir] | |
ftp = FTP(sys.argv[1]) | |
ftp.login() | |
ftp.cwd(sys.argv[2]) | |
for root, dirs, files in os.walk(sys.argv[3]): | |
ftp.mkd(root) | |
print root | |
for f in files: | |
ff = root + '/' + f | |
print ff | |
ftp.storbinary('STOR ' + ff, open(ff, 'rb')) | |
ftp.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
no upload :'(