Okay so let me show you the script,
#!/usr/bin/python
# usage: python ftp.py filename
import os,sys
from ftplib import FTP
server = 'ftp.domain-example.com'
username = 'your-username'
passwd = 'your-pass'
filename = sys.argv[1]
ftp = FTP(server)
ftp.login(username,passwd)
fp = open(filename, 'rb')
ftp.storbinary("STOR "+filename, fp)
ftp.quit()
for use it just type on your command line (terminal) with this command :
$python ftp.py filenameChange "filename" with your filename that you want to upload it to your server.
Its DONE!
0 comments:
Post a Comment