Automating FTP file transfers
jcribbs at twmi.rr.com
Sat Nov 15 19:39:23 CET 2003
Limey Drink wrote:
> Just wondering about the bigger picture with regards to sys admin scripts,
> in your opinion, is creating these type of system administration scripts
> preferable/easier than using say bash scripts, or DOS .bat scripts ?
> Just wondering if you think I should be trying to execute the in built OS
> programs such as FTP etc. calling them from python or should I be using the
> libraries that come with Python such as FTPlib and say if I wanted to send
> email should I be using the SMTP lib rather than say executing the mail
> program in unix and passing arguments from a Python script.
Just to give you my $.02 on this. I have literally dozens of Python ftp
scripts that run on a Linux server at my company daily via cron. All of
my scripts use ftplib and smtplib. My basic script structure is:
1). Check local directory to see if files are available for sending.
2). Encrypt local files via PGP.
3). FTP files to external vendor using ftplib.
4). Send "success" email to myself and other interested parties via
5). If the script error's out instead, send error email to me so I know
there is a problem.
IMO, Python is an excellent choice for this kind of stuff.
Hope this helps!
More information about the Python-list