Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

How can I retrieve a file from a UNIX server using Perl on a Windows NT client?

( #11174=categorized question: print w/ replies, xml ) Need Help??
Contributed by Anonymous Monk on May 11, 2000 at 20:13 UTC
Q&A  > HTTP and FTP clients


Description:

I need to copy a file from a UNIX server on to a Windows NT client, while logged on to the client using Perl. Is there an FTP module in Perl which runs on Windows NT, which can help me do this?

Alternatively, what is the best way to accomplish this? Please remember, I need to access this file from the client.

Answer: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?
contributed by mikeock

Error checking can be acheived through the following code:

$ftp->login($user,$pass) or die "Either $user or password is incorrect" ,$ftp->message;

Note the $ftp->message. I dunno if this is new to this module but it is worth noting so that if new users are still using these sections, the FAQ's should reflect some of the new features that the modules support.

Answer: How can I retrieve a file from a UNIX server using Perl on a Windows NT client?
contributed by chromatic

Net::FTP from CPAN might come in handy. From the perldoc page (but with error checking added):

use Net::FTP; $ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Can't FTP to some.host.name: $@\n"; $ftp->login("anonymous",'me@here.there') or die "Anonymous access denied!\n"; $ftp->cwd("/pub") or die "Can't chdir to remote /pub.\n"; $ftp->get("that.file"); or die "Can't fetch that.file.\n"; $ftp->quit;
Looks pretty easy.

Edit 2001-03-11 by tye to add error checking. tye is quite disappointed that Net::FTP does not give you access to the reasons for any failures other than of new().

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (10)
    As of 2014-10-02 13:33 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      What is your favourite meta-syntactic variable name?














      Results (60 votes), past polls