Hi Experts, I am facing a issue with FTP section in my perl script. I am trying to get a list of log files from a mobile device. It has FTP server running. Here is the script =========================================
use File::Path; use File::Copy; use File::Basename; use Net::FTP; open(FILE, "<", "api_log_file.txt"); while(<FILE>) { chomp; push(@arr, $_); } close(FILE); chdir("C:/OzoneAPI3Regresssion/Logs"); print "Connecting to HH Device 192.168.2.35 ................ "; my $ftp=Net::FTP->new("192.168.2.35",Debug => 1,Passive => 0,Timeout=> +1000); if ( !$ftp ) { die "Cannot connect to the ftp server: $@\n"; } else { print "done\n"; } print "Passing credentials ....................... "; $ftp->login("admin","admin") or die "Could not login\n",$ftp->messag +e; print "done\n"; foreach(@arr) { print "array element: $_\n"; chomp($_); $ftp->binary; $ftp->get("$_") or die "Cannot get $_: $! $^E\n"; } print "Closing connection ........................ "; $ftp->quit; print "done\n"; ====================
When I run this I am getting the following error.
Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.62) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.30_01) Net::FTP>>> IO::Handle(1.27) Net::FTP=GLOB(0x1f04884)<<< 220 FreeFloat Ftp Server (Version 1.00). Connecting to Ozone Device 192.168.2.35 ................ done Net::FTP=GLOB(0x1f04884)>>> USER admin Net::FTP=GLOB(0x1f04884)<<< 331 Password required for admin. Net::FTP=GLOB(0x1f04884)>>> PASS .... Net::FTP=GLOB(0x1f04884)<<< 230 User admin logged in. Passing credentials ....................... done array element: Access_Sequence_DotNet_Log.html Net::FTP=GLOB(0x1f04884)>>> PORT 192,168,2,31,14,49 Net::FTP=GLOB(0x1f04884)<<< 200 PORT command successful. Net::FTP=GLOB(0x1f04884)>>> RETR Access_Sequence_DotNet_Log.html Net::FTP=GLOB(0x1f04884)<<< 550 \Access_Sequence_DotNet_Log.html : can +'t find the file Cannot get Access_Sequence_DotNet_Log.html : Bad file descriptor
Can I get some assistance? Regards Amit

In reply to Bad File descriptor Error by amvarma

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.