I modified the code like this but the uncompress part seems to give me problem, Here is the modified code--
#!/usr/bin/perl use Net::FTP; use IO::Uncompress::Unzip qw(unzip $UnzipError) ; use IO::File ; print "Retrieving file from abc.com...\n"; $loginip='123.456.0.23'; $loginid='nt1234'; $loginpaswd='defgsljf'; ($sec,$min,$hour,$mday,$mon,$year)=(localtime(time))[0,1,2,3,4,5]; $time_stamp= "_" . (1900+$year) . "_" . ($mon+1) . "_" . ($mday) . "_" + . $hour . "_" . $min . "_". $sec; printf "time stamp = $time_stamp\n"; unless(-d "temp") { mkdir("temp"); } if( -d "temp") { chdir("temp"); } $ftp = Net::FTP->new(($loginip), Debug => 0) or die "Cannot connect to abc.com: $@ \n"; $ftp->login($loginid,$loginpaswd) or die "Cannot login ", $ftp->message; $source_dir="/abc/nali05/"; $ftp->cwd($source_dir) or die "Cannot change working directory ", $ftp->message; $ftp->binary || die "Unable to set mode to binary. ", $ftp->message; @list=$ftp->ls(); printf "list = \n"; print @list; foreach $file (@list) { unzip "$file" => "$source_dir"' or die "unzip failed: $UnzipError\n"; if($file =~ m/namish*/i) { $ftp->get($file) or die "get failed ", $ftp->message; #rename($file,"${file}_${time_stamp}"); $ftp->delete ($file) or die "rm -rf failed ", $ftp->message; } } $ftp->quit;
When i use my code without uncompress part it works fine. But i want to uncompress it first and choose files and ftp only those files. When i run the script i get this error--
C:\Perl Script>perl ftp1.pl Can't locate IO/Uncompress/Unzip.pm in @INC (@INC contains: C:/Perl/li +b C:/Perl/ site/lib .) at ftp1.pl line 3. BEGIN failed--compilation aborted at ftp1.pl line 3.
Thanks NT

In reply to Re^4: ftp issue in perl by namishtiwari
in thread ftp issue in perl by namishtiwari

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.