I am not getting the desired results as the files are not copied,am i missing anything here. It prints these lines--#!/usr/bin/perl use Net::FTP; my $host="abc.def.com"; my $directory="/namish/logs/nali05/"; $ftp=Net::FTP->new($host,Timeout=>240) or $newerr=1; push @ERRORS, "Can't ftp to $host: $!\n" if $newerr; myerr() if $newerr; print "Connected\n"; $ftp->login("abcd","hi1234\@") or $newerr=1; print "Getting file list"; push @ERRORS, "Can't login to $host: $!\n" if $newerr; $ftp->quit if $newerr; myerr() if $newerr; print "Logged in\n"; $ftp->cwd($directory) or $newerr=1; push @ERRORS, "Can't cd $!\n" if $newerr; myerr() if $newerr; $ftp->quit if $newerr; @files=$ftp->dir or $newerr=1; push @ERRORS, "Can't get file list $!\n" if $newerr; myerr() if $newerr; print "Got file list\n"; foreach(@files) { print "$_\n"; } $ftp->quit; sub myerr { print "Error: \n"; print @ERRORS; exit 0; }
Kindly give your valueable suggestions. I want to clear what exactly i am doing here.. I wrote the above perl script to get the files in a specifed directory called temp. The files which i get all are zipped ones. I want to unzip all the files and choose some which of my interest and delete rest of the files. I achieved the first part but i am struglling for the second. The files which i am getting after ftp are like this-- tali05_Jul122009_2358.zip tali05_Jul122009_4567.zip tali05_Jul122009_9876.zip I want to unzip all these files after getting them. When we unzip these files we get files like-- nt123_12Jul09_13_05_23.log ntrf_12Jul09_14_35_33.log and many more like this.. I want to keep only the first one and delete the second file. Kindly help me in achieving this. Thanks NT Reply With Quote Thanks NTRETRIEVING AOK LOG FILES FROM LOG.ARCOT.COM...... Connected Getting file listError: Can't login to abc.def.com:
In reply to ftp issue in perl by namishtiwari
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |