Experts,
I'm having problem in FTP during the "cwd" command.
Error msg i'm getting "The filename, directory name, or volume label syntax is incorrect"
What actuallly i'n trying to do is FTP file from unix to window.
Default directory (C:\BoxiEvents) is set at Windows FTP server
if i omit cwd command , FTP works and places test_event file in default location.
but it fails when i try FTP on specific directoty under BoxiEvents folder(like metioned below )
Would appreciate if anybody has any idea on how can i resolve this .
Regards
Shakir
Code
--------------------------
----------
----------
----------
---------
my $eventFileName = 'test_event';
my $dir='C:\\BoxiEvents\\ER';
#server, user and password are all defined
#FTP server is installed on windows 2000
# Set the server to log on to
my $ftp = Net::FTP->new($server,Debu
g=>1) || die "ERROR connecting to FTP server: $@\n";
# Login
$ftp->login($user,$pswd) || die "ERROR couldn't login.Please check the crendentials\n";
# Change to destination directory
if ($dir){
$ftp->cwd("$dir") || die "ERROR couldn't change directory '$dir' ", $ftp->message;
}
# Set file transfer type to binary
$ftp->binary();
my $ftpFile ='/tmp/'.$eventFileName ;
open (FILE,">$ftpFile");
close FILE;
# Transfer the file
$ftp->put($ftpFile) || die "ERROR: Could not transfer file to server: $@\n";
$ftp->quit();
Start Free Trial