Reputation: 9803
In regards to the question I previously posted, I have written the following script to load a specific file:
#!/bin/perl
use strict;
use Net::FTP;
my $ftpOb = Net::FTP->new("X")
or die ("Could not connect to the FTP Server: $@");
print "Connected \n";
$ftpOb->login("A", "B")
or die ("Incorrect server credentials");
print "Logged in \n";
print " Current folder is: " . $ftpOb->pwd();
$ftpOb->cwd("root/Folder") or die ("Cannot connect to the folder on Server");
print "Transferred to folder \n";
$ftpOb->get("621418185-006249189002-5383.txt")
or die ("Error occured while fetching the file");
$ftpOb->quit;
However, the code seems to fail to change the working directory and I get the following output:
Connected
Logged in
Cannot connect to the folder on Server at ./GetUploadFile.pl line 16.
Current folder is: /
Can anyone please help me debug the issue here?
Upvotes: 2
Views: 1095
Reputation: 6524
Include $ftpOb->message()
in your error messages (except for the connect, where $@
is the correct error message).
Also do a dir() and list what files/directories are available.
Upvotes: 2