I have a file in unix box and i want to move it to ftp server box:
from ftplib import FTP_TLS
ftps = FTP_TLS('ftpservername', 'username', 'password','portnumber')
ftps.prot_p()
files = ftps.dir('/')
ftps.cwd("/ftpserver file path/")
localfile = '/unix file path where file exit/'
import os
fp = open(localfile, 'rb')
ftps.storbinary('STOR %s' % os.path.basename(localfile), fp, portnumber)
fp.close()
ftps.quit()
Note : only you have to change the red marked fields with your server/path details .
ftps = FTP_TLS('ftpservername', 'username', 'password','portnumber')
ftps.prot_p()
files = ftps.dir('/')
ftps.cwd("/ftpserver file path/")
localfile = '/unix file path where file exit/'
import os
fp = open(localfile, 'rb')
ftps.storbinary('STOR %s' % os.path.basename(localfile), fp, portnumber)
fp.close()
ftps.quit()
Note : only you have to change the red marked fields with your server/path details .
No comments:
Post a Comment