How do I upload multiple excel files to multiple FTP folders using python or VB? -
i needing move 40 excel spreadsheets various folders on ftp site(daily) based on excel file name.
for example if file1.xls moved directory's folder if file2.xls moved directory's folder b , forth.
so there 40 files , 40 directories. can please me automate in python or vb?
i appreciate help, jaimi
have @ ftplib
. here untested code started:
import ftplib files = ( # list files , dirs here ('local_file1.xls', 'target_dir1'), ('local_file2.xls', 'target_dir2'), # etc. ) ftp = ftplib.ftp("ftp://example.com") ftp.login() filename, directory in files: f = open(f, 'rb') ftp.cwd(directory) ftp.storbinary("stor %s"%filename, f) ftp.cwd('..') f.close()
Comments
Post a Comment