
hothat
Deleted
Mar 1, 2000, 1:09 PM
Post #1 of 3
(307 views)
|
|
How do I selectively upload via FTP Win NT files?
|
Can't Post
|
|
Hello! I have two related struggles with this code at the moment. First, I am attempting to PUT selective files to a remote site from a Win NT box. How do I read the desired local Win directory? Secondly, on my selection, I only want to upload those files that are 8 and only 8 digits for their filetitle -- my regexp needs polishing. Here is the block of troublesome code: my $file_put_regexp = "12345678"; #my $file_put_regexp = '\d\d\d\d\d\d\d\d'; chdir($local750_dir) or log_msg("Couldn't change dir to $local750_dir: $!", 1); my $ftp = Net::FTP->new($ftp_put_host, Passive=> $passive_mode, Debug => $debug_ftp); log_msg("Couldn't start FTP client: $!",1) if !$ftp; $ftp->login($username_put, $password_put) or log_msg("Couldn't login as $username_put: $!",1); $ftp->ascii or log_msg("Couldn't specify ascii"); $ftp->quot($site750_put) or log_msg("Couldn't specify $site750_put: $!" ,1); # the listing command needs to go against the local750dir $ftp->cwd($local750_dir) or log_msg("Couldn't change FTP dir to $local750_dir: $!",1); #my @listing = $ftp-> ls() # or log_msg("Couldn't retrieve local file listing: $!", 1); my $listing = readdir DIR; my @files = grep(/$file_put_regexp/,@$listing); log_msg("No files matching the 750 regexp $file_put_regexp were found",1) if !@files; foreach $file (@files) { $ftp->put($file) or log_msg("Couldn't get $file: $!",1); log_msg("Successfully placed $file"); #do housekeeping now and delete this file out of local750_dir, NOT the remotedir $ftp->delete($file) or log_msg("Couldn't delete $file: $!",1); } $ftp->quit(); This is my first post! I will look forward to any assistance that you can offer. Thanks.
|