I am trying to write a script that will get a file from a PC and place it on a local server. Using Net::FTP this works fine......however a bright spark in audit has decided that the file on the PC should be MD5'ed before transfer and the MD5 validated on the server after retrieval. Fine! Just one problem, now that I don't know the full name of the file to be transferred I need to be able to use a wildcard. This I cannot get to work. Is this possible? The remote PC has Perl installed if that helps?

#!/usr/bin/perl -w # use Net::FTP ; # Used because se +ctran requires a responder on the PC # # ############################################################### # FTP Variables # ############################################################### # my $file_in = "TRISCAN.txt.*" ; my $password = 'summit' ; my $username = 'summitelse' ; my $host = 'PCxxxx' ; my $ftp = undef ; my $msg = undef ; # #################################################################### # P R O C E S S I N G # #################################################################### # print "\n\tNet::FTP Test begins\n" ; # if ($ftp = Net::FTP->new($host, Debug => 0, Timeout => 10)) { print "\n\tFTP Connection established with $host\n" ; } else { $msg = "\n\tFTP Connection failed with $host\n" ; print $msg ; exit 0 ; } # ################################################################ # Login with the username/password details # ################################################################ # if ($ftp->login($username,$password)) { print "\n\t$username login accepted\n" ; } else { $msg = "Username $username or password invalid!" ; print "\n\t$msg\n" ; exit 0 ; } # ############################################################### # Try and get the file # ############################################################### # if ($ftp->get("$file_in")) { print "\n\tYippee we goat the bleedin' file!\n" ; } else { $msg = "Oh Frag we didnae get the blighter!" ; print "\n\t$msg\n" ; exit 0 ; } # ############################################################## # Try and quit the FTP # ############################################################## # $ftp->quit ; # ###################################################################### +##### # Check that the transfer went okay. If the file doesn't exist the + # # transfer definitely failed. + # ###################################################################### +##### # if (! -e $file_in) { $msg = "No $file_in exists after FTP has completed" ; exit 0 ; } # ############################################################# # Toodle pip # ############################################################# # print "\n\tNet::FTP Test Ends\n" ;

Any suggestions?

READMORE tags added by Arunbear


In reply to FTP & MD5 by Ronnie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.