I am not sure how I would be able to accomplish this, still fairly new to using Perl.

Objective: Connect to a remote machine and list all files matching a given pattern (i.e. 02242002-www.tar.gz, where 02242004 is the day of month). Delete all files that are older than 30 days from last file listed.

Here is what I have thus far, and it works (not too shaby for a newbie).

#!/usr/bin/perl

use Net::FTP;

$ftp = Net::FTP->new("test-serv", Debug => 1)or die "Could establish conneciton to test-serv: $@";

$ftp->login("user", 'password')or die "Could not login ", $ftp->message;

foreach my $list(glob('*-www.tar.gz')) {
 $ftp->ls($list)or die "Could not list files ", $ftp->message; }

foreach my $del(glob('

foreach my $file (glob('/path/to/*-www.tar.gz')) {
 $ftp->put($file) or die "Could not transfer files ", $ftp->message; }

$ftp->quit;

I suppose I need to look up how to check dates and then do some sort of eval() but I am not sure... any help or pointers to a good tutorial on this kinda thing is appreciated.
Jas





-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to