[Newlug] Automation of FTP
D. Stark
dirk at oceallc.com
Wed Sep 15 13:03:15 CDT 2004
If you need help, give a holler.
Dirk
On Wed, 15 Sep 2004 BBingham at belkauusa.com wrote:
>
> I agree with you that perl would be a good choice. I am looking at using
> it if at all possible.
>
>
>
> Brad Bingham
> EDI Coordinator
> Bel/Kaukauna USA
>
> 920.788.3525 x 340
>
>
>
> "D. Stark"
> <dirk at oceallc.com To: newlug at newlug.org
> > cc:
> Sent by: Subject: Re: [Newlug] Automation of FTP
> newlug-admin at newl
> ug.org
>
>
> 09/15/2004 12:47
> PM
> Please respond to
> newlug
>
>
>
>
>
>
> <shrug>
>
> I write perl code about 7 hours of my 9 hour workday (the rest being HTML
> or Photoshopping). Seemed like a natural way to do it. :-)
>
>
> On Wed, 15 Sep 2004, GaveUp wrote:
>
> > While I do think that your way is the better way to do it if you are just
> looking to use a shell script or some such, then you can echo commands to
> ftp (or some other cli ftp client) and when run like y = `$command` you'll
> catch the output which you can parse.
> >
> > On Wed, Sep 15, 2004 at 08:55:10AM -0500, D. Stark wrote:
> > > Hrm, scripting the deletion would be the tough part. HOWEVER, it *is*
> > > pretty easy to accomplish with Perl and Net::FTP. Example from the
> > > O'Reilly Perl Nutshell:
> > >
> > > ----------------------------------
> > > #!/usr/local/bin/perl -w
> > >
> > > use Net::FTP;
> > >
> > > $hostname = 'remotehost.com';
> > > $username = 'anonymous';
> > > $password = 'myname at mydomain.com';
> > >
> > > # Hardcode the directory and filename to get
> > > $home = '/pub';
> > > $filename = 'TESTFILE';
> > >
> > > # Open the connection to the host
> > > $ftp = Net::FTP->new($hostname); # construct object
> > > $ftp->login($username, $password); # log in
> > >
> > > $ftp->cwd($home),"\n"; # change directory
> > > print $ftp->ls($home),"\n";
> > >
> > > # Now get the file and leave
> > > $ftp->get($filename);
> > > $ftp->quit;
> > > ----------------------------------
> > >
> > > You might want to consider it even if you only use Perl for the
> deletions
> > > and use wget for everything else. The nice thing about doing the gets
> from
> > > within perl is that you can smatter "die" statments and emailers at
> every
> > > point in the game.
> > >
> > > On Wed, 15 Sep 2004 BBingham at belkauusa.com wrote:
> > >
> > > >
> > > > I am currently working on a project to automate a process of using
> ftp to
> > > > pickup files and then delete those files on the ftp server. Our plan
> is to
> > > > use ftp with the mget and then pickup all the files on the server,
> then
> > > > deleting those files one by one from the server to avoid deleting
> files
> > > > that may be placed there after our initial grabbing them. In this
> process
> > > > we also want to be able to test the return codes of ftp so that we
> can
> > > > handle any errors correctly.
> > > >
> > > > Does any one know of a way we can do this using standard Unix ftp?
> > > >
> > > >
> > > >
> > > > Brad Bingham
> > > > EDI Coordinator
> > > > Bel/Kaukauna USA
> > > >
> > > > 920.788.3525 x 340
> > > >
> > > >
> > >
> > > --
> > > -- ------------- dirk @ oceallc.com ----------------- --
> > > "All I WANT is a stiff drink and a peer group!"
> > > -- Ford Prefect
> > > -- --------------------------------------------------- --
> >
>
> --
> -- ------------- dirk @ oceallc.com ----------------- --
> "All I WANT is a stiff drink and a peer group!"
> -- Ford Prefect
> -- --------------------------------------------------- --
>
>
>
>
>
>
>
--
-- ------------- dirk @ oceallc.com ----------------- --
"All I WANT is a stiff drink and a peer group!"
-- Ford Prefect
-- --------------------------------------------------- --
More information about the Newlug
mailing list