I'm trying to finish this script which should upload files
to a secure ftp site.
When I removed the win32::autoglob, the script doesn't read
the path or the files passed in the @filemask.
When I added it back in, it only captures what I had passed, ex:
c:\test\*.txt
But what I want to use it as is a file list. So I would like it to have
a list of files such as:
test1.txt
test2.txt
test3.txt
Please help.
Thanks,
Liza
#!/usr/bin/perl use warnings;
use Net::FTPSSL;
use Win32::Autoglob;
use File::Copy;
use File::Basename;
my $ftpaddress;
my $username;
my $password;
my $port;
my $remotedir;
my $newpath;
my @filemask;
$ftpaddress = shift ( @ARGV ); # Example: ftp.ftptest.com
$username = shift ( @ARGV ) ; # Example: ftptest
$password = shift ( @ARGV ); # Example: test123
#$port = shift (@ARGV); # Example: 21
$remotedir= shift ( @ARGV ); # Example: upload
$newpath = shift (@ARGV); # Example: c:\ftp\uploaded
@filemask = shift ( @ARGV ); # Example: c:\ftp\test*
print "***************************BEGIN FTP
LOG**************************************\n";
my $ftps = Net::FTPSSL->new($ftpaddress,Port => 990 ,Encryption => 'I',
Debug => 0)
or die "Can't open $ftpaddress";
$ftps->login($username,$password)
or die "Can't login, check username and password.\n";
$ftps->binary;
$ftps->cwd($remotedir) or die "Can't change directory.\n";
foreach $file (@filemask){
print "Uploading $file\n";
$ftps->put($file) || die "Error: Upload Failed! Unable to upload $filemask
to $ftpaddress \n";
#print "Moving $filemask to $newpath\n";
#move($filemask,$newpath) || die "Unable to move $filemask to $newpath.\n";
}
#print "File uploads completed\n";
$ftps->quit();
print "***************************END FTP
LOG**************************************\n";
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs