perlwhite
asked on
FTP change directory
Hello,
I am trying to FTP a file from one machine to another server. However, it is unable to change the directory. I have following so far-
my $ftp_remote_addr='abc';
my $ftp_user = 'bxyz';
my $ftp_pass ='lmn';
my $ftp_cwd_path = "";
my $ftp_put_filename= 'C:\\abc\\abc\\123.txt';
########################## ########## #########
my $ftp = Net::FTP->new($ftp_remote_ addr, Debug => 0) ||
die "Connect to $ftp_remote_addr failed: $@";
$ftp->login($ftp_user, $ftp_pass) or die "Cannot login ", $ftp->message;
chdir("/ftproot/test/")
or die("Can't change to dir $!\n");
#$ftp->cwd($ftp_cwd_path) or die "Cannot change working directory ", $ftp->message;
print $ftp->pwd();
$ftp->put($ftp_put_filenam e) or die "Failed to transfer file ", $ftp->message;
$ftp->quit;
Error- cannot change working dorectory
for pwd- I get / as output
Please let me know where I am going wrong.
Thanks,
I am trying to FTP a file from one machine to another server. However, it is unable to change the directory. I have following so far-
my $ftp_remote_addr='abc';
my $ftp_user = 'bxyz';
my $ftp_pass ='lmn';
my $ftp_cwd_path = "";
my $ftp_put_filename= 'C:\\abc\\abc\\123.txt';
##########################
my $ftp = Net::FTP->new($ftp_remote_
die "Connect to $ftp_remote_addr failed: $@";
$ftp->login($ftp_user, $ftp_pass) or die "Cannot login ", $ftp->message;
chdir("/ftproot/test/")
or die("Can't change to dir $!\n");
#$ftp->cwd($ftp_cwd_path) or die "Cannot change working directory ", $ftp->message;
print $ftp->pwd();
$ftp->put($ftp_put_filenam
$ftp->quit;
Error- cannot change working dorectory
for pwd- I get / as output
Please let me know where I am going wrong.
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't know Perl but shouldn't you at least be using / for the folder not just a blank string
ASKER
It was the root path for FTP site. I changed it and works fine.
What do you mean It was the root path for FTP site What did you change it to?