use File::Path; use File::Copy; use File::Basename; use Net::FTP; open(FILE, "<", "api_log_file.txt"); while() { 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->message; 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"; ====================