#!/usr/bin/env python
import ftplib
import os
import sys
if len(sys.argv) < 2:
print "Usage: %s file [file2] [file3] ..." % os.path.split(sys.argv[0])[1]
sys.exit()
# Clear the screen?
#os.system('clear')
print "Files to upload:"
print sys.argv[1:], "\
"
ftp = ftplib.FTP('www.xxxxxx.com')
login = "xxxx"
passwd = "xxxx"
ftp.login(login, passwd)
ftp.dir()
#Upload DIR
dir = "/public_html/uploads/"
ftp.cwd(dir)
for file in sys.argv[1:]:
name = os.path.split(file)[1]
print "Uploading \\"%s\\" ..." % name,
f = open(file, "rb")
ftp.storbinary('STOR ' + name, f)
f.close()
print "OK"
print "Quitting..."
ftp.quit()