
karthi_perl
Novice
Jan 1, 2012, 10:44 PM
Post #1 of 19
(8237 views)
|
FTP Files from Linux to DB2
|
Can't Post
|
|
Hi All, I am newbie to this forum. I am also new to PERL script world. I have written a perl script to transfer three files from linux to db2. Here is the script. #!/usr/bin/perl #use strict; use warnings; use Net::FTP; use Cwd; use File::Basename; ################################ #Main Execution begins here ################################ $ftp = Net::FTP->new('ftp-utility.xx.xx.com', Debug => 0) or die "Couldn't connect to: $@\n"; $ftp->login('west.xxx.com','xxx') or die "Couldn't login to PSS server\n", $ftp->message; $ftp->pwd(); print "change directory to /send\n"; $ftp->cwd(' send' ) or die "Couldn't change directory\n", $ftp->message; #change directory to location of this perl file chdir("/bis_data/msg/IProp_Data_Automation/Output/PSS"); #Get PSS Files $ifile = 0; @files = ('PLP301C1.TXT', 'PLP301C2.TXT', 'PLP302C1.TXT'); foreach(@files) { print "Attempting get $files[$ifile]\n"; #$ftp->put($files[$ifile]) or die "FTP get failed ", $ftp->message; print "$files[$ifile] is copied to: ", Cwd::abs_path($files[$ifile]), "\n"; $ifile++; } $ftp->quit; ################ When i run the script, i don't get any error message. But i don't see those 3 files in the destination server. is there any change needs to be done in the script? Inputs are welcome!
|