[Wylug-help] Scriptable FTP, creating remote archives

Smylers Smylers at stripey.com
Fri Dec 2 12:11:48 UTC 2011


James Holden writes:

> The ancient command line FTP client can do it as follows:
> 
> > put |"tar czf - somedir" archive.tgz
> 
> ...but my usual choice for scriped FTP, lftp, doesn't understand this.
> 
> Anyone got any ideas?

The Perl Net::FTP module? A one-liner like this should work:

  $ tar czf - somedir | perl -MNet::FTP -we '$c = Net::FTP->new(q[ftp.example.net]); $c->login(qw<james p at 5Sw0rd>); $c->binary; $c->put(\*STDIN, q[archive.tar.gz])'

Smylers



More information about the Wylug-help mailing list