Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Simple command line FTP

by Anonymous Monk
on May 27, 2009 at 13:58 UTC ( [id://766422]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monkss.

I know there are modules out there for FTP, namely Net::FTP, but modules are frowned upon in my environment. All I want to do is log into a local FTP on our network with my credentials, load one directory, and download everything in that one directory (they are all the same kind of file). Essentially that's it. It doesn't have to do anything fancy.

Is there an easy pure-perl way to do this?

#!/usr/bin/perl use warnings; use strict; system("ftp TEMPERED"); system("username"); system("password");

Replies are listed 'Best First'.
Re: Simple command line FTP
by rovf (Priest) on May 27, 2009 at 15:00 UTC

    This restriction applies also to standard modules??? Well, if you really want to drive your ftp, it depends on what ftp client you are using. For instance, some ftp clients make use of .netrc, so you could create such a file (see for instance http://www.mavetju.org/unix/netrc.php) and then use system to execute it.

    -- 
    Ronald Fischer <ynnor@mm.st>
Re: Simple command line FTP
by Anonymous Monk on May 27, 2009 at 14:03 UTC

      No need to revert to CPAN here, unless you have a very old Perl: At least in 5.8, Net::FTP comes bundled with Perl, so it kind of *is* part of Perl.

      -- 
      Ronald Fischer <ynnor@mm.st>
        And here's the link to prove it is a Core module: Net::FTP
Re: Simple command line FTP
by arc_of_descent (Hermit) on May 27, 2009 at 15:57 UTC

    Why pure-perl? There are other tools available which are more suited for interactive command applications, like Expect. It most probably is already available in your environment.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://766422]
Approved by AnomalousMonk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found