Automating FTP file transfers

Limey Drink bhicking at bhicking.plus.com
Wed Nov 12 11:40:39 EST 2003


Thanks very much for the help guys I now know how to connect using python
ftp library and I am happy with this but...

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 ?

Because I don't have alot of experience of sys admin and shell scripting I'm
just wondering if I am applying Python for one of its intended uses doing
these type of scripts.

IMHO i would rather learn and stick with Python than to learn all the
different scripting languages as it is cleaner and more powerful and also if
the script is written correctly it seems could be cross platform.

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.

It would hear interesting to hear your views on this as it would be nice if
I can gain from others experience and not make the same mistakes.

Thanks again

"Limey Drink" <bhicking at bhicking.plus.com> wrote in message
news:HQqsb.7375$lm1.50918 at wards.force9.net...
> Hi all,
>
> Firstly :-) , is there any where I can search through archived newsgroup
> posts so I am not cluttering up the newsgroup with repeated queries ?
>
> And secondly :-), I know this has probably been discussed before but.
>
> I am wanting to do some scripting to automate a few administration tasks,
> one of the first tasks is automating FTP file transfers.
>
> I would like to know if the following could be made more robust using
python
> and its FTP libraries rather than executing native OS commands in a shell
> script.
>
> Basically I need to...
> 1.  Check on the local system for new files in a specific directory
> If new files exist then...
> 2.  Connect to a remote FTP server.
> 3.  Transfer local files to a specific directory on the remote FTP server.
> 4.  Then remove/archive local files and end session.
>
> This is critical operation and though while in the past I have written DOS
> scripts etc. to do simple tasks I have not needed to check for errors as
> they weren't absolutely critical tasks.  I am going to need to run this
> overnight using AT or CRON then I need to know about file transfer errors
> etc. and other problems that f I were actually performing the FTP transfer
> manually I would get feedback of the problem and could re-try the
operation.
>
> Any help would be very appreciated.
>
>
>






More information about the Python-list mailing list