Okay, my friends, see you again. Today i will share to you the simple python script for uploading file via ftp (file transfer protocol). This script is very simple and tiny file. Just Copy and paste this script to your notepad or text editor, and edit with your ftp server address, username and password, after that just save with *.py in case i save it with ftp.py name.
Okay so let me show you the script,
for use it just type on your command line (terminal) with this command :
Its DONE!
Read rest of entry
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!
