[olug] Unix Tip: FTP AUTOMATED TRANSFERS

Jay Hannah jay at jays.net
Thu Jun 19 13:26:48 UTC 2003


I would energetically recommend Perl's Net::FTP for FTP automation. It's
very slick.

http://search.cpan.org/author/JHI/perl-5.8.0/lib/Net/FTP.pm

I just wrote a higher level OO abstraction on top of Net::FTP for work
which loads all kinds of configuration stuff for me automatically
depending on who I'm connecting to. (Our abstraction also automagically
PGP de/encrpyts, emails notifications out, etc.)  

Jay Hannah
Omaha Perl Mongers: http://omaha.pm.org



Unix Guru Universe wrote:
> FTP AUTOMATED TRANSFERS
> 
> To add to the earlier tip
> on automated transfer using
> FTP, you can define a macro
> by name 'init' which will
> automate the whole transfer.
> 
> Defining the macro.
> 
> In the .netrc file after the
> definition for the machine
> name,add the following
> definition.
> 
> macdef init
> bin
> hash
> cd <directory>
> !cd <directory>
> put/get <filename>
> bye
> 
> The line begining with macdef
> starts the definition of a
> macro.All the sub sequent
> lines upto a blank line (or
> end of file)  are part of
> the macro.
> 
> Now if you type ftp
> <machine name> at the prompt,
> the whole ftp will happen
> automatically.
> 
> These macros can also be
> defined in any other name in
> which case,you will have to
> type the macro name at the
> ftp prompt for its statements
> to get executed.
> 
> This tip generously supported by: subha at hitechclub.com
> 
> --------------------------------------------------------------------------
> To Subscribe:    http://www.ugu.com/sui/ugu/show?tip.subscribe
> To Unsubscribe:  http://www.ugu.com/sui/ugu/show?tip.unsubscribe
> To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
> 
> ==========================================================================
> DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
> NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
> GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU  ADVISES THAT
> ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
> 
> Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
> ==========================================================================
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug


More information about the OLUG mailing list