I am now able to develope the list of files, but the code can't find the files in the local directory.
I have tried using '$dir$file', which lists the directory and then the file, but the "\" is missing so the string is meaningless.
I have '$dir/$file', '$dir\$file, and '$dir\\' and they error with comments about missing operator.
I even tried '$temp=$dir . "\" . $file;'
It complained about run away ".
can anybody help??
Now that I have the list of files, how do I get the FTP command to include the directory path?
Code:
#!/usr/bin/perl -w
use Net::FTP;
$vName1 = 'D:\Inetpub\ftproot\Invoice\ghxInv.bak';
$dir = 'D:\Appdata\Invoice';
$host = 'edmapp';
$username = 'who_dat.org';
$password = '12345';
if (-e $vName1)
{
## $rc=system("del /Q $vName1");
$rc=system("cd $dir");
opendir($dh, $dir) or die "can't opendir $dir: $!";
@files = readdir($dh);
$ftp=Net::FTP->new($host, Debug => 0) or die "No connection";
$ftp->login($username, $password) or die "cannot login", $ftp->message;
$ftp->cwd(olc_upload_v0j5) or die "can't cwd ", $ftp->message;
$ftp->binary();
for $file (@files)
{
chomp @files;
next if $file =~ /^\.{1,2}$/;
print "$file\n";
## $ftp->put($file) or die "put failed ", $ftp->message;
}
$ftp->quit;
closedir $dh;
}
I have tried using '$dir$file', which lists the directory and then the file, but the "\" is missing so the string is meaningless.
I have '$dir/$file', '$dir\$file, and '$dir\\' and they error with comments about missing operator.
I even tried '$temp=$dir . "\" . $file;'
It complained about run away ".
can anybody help??
Now that I have the list of files, how do I get the FTP command to include the directory path?