![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deleting a file from REMOTE Unix Server | Raamc | Shell Programming and Scripting | 2 | 10-22-2008 10:42 AM |
| Deleting a file located on another server | SanketJOSHI | Shell Programming and Scripting | 2 | 05-08-2008 08:02 AM |
| Deleting a file located on another server | SanketJOSHI | UNIX for Dummies Questions & Answers | 1 | 05-08-2008 07:29 AM |
| df -k and deleting files | ajayr111 | UNIX for Dummies Questions & Answers | 4 | 03-14-2007 08:03 PM |
| Deleting old files | shiroh_1982 | Shell Programming and Scripting | 2 | 06-21-2006 05:42 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi,
I'm quite new to unix and perl scripting and need to write a script to delete files older than 7 days from a remote ftp server. Unix or Perl script would do... I wrote the following code: #!/usr/local/bin/perl use File::Basename; use Net::FTP; #use Net::FTP::File; my $verbose = 0; my $proxy = @ARGV[0]; my $host = @ARGV[1]; my $ftpuser = @ARGV[2]; my $ftppass = @ARGV[3]; my $remoteDir = @ARGV[4]; my $filetoDelete = @ARGV[5]; my $ftp=Net::FTP->new($host, Debug => 0, Passive => 0, Hash => ($verbose ? \*STDOUT : undef), FirewallType => 1, Firewall => $proxy, ) or exit(1); $ftp->login($ftpuser,$ftppass) or exit(2); chomp($remoteDir); if ( $remoteDir ne "/" ) { $ftp->cwd($remoteDir) or exit(3); print $remoteDir; } @files=$ftp->ls or exit(4); foreach(@files) { print "$_ \n"; $ftp->delete($_) ; } $ftp->quit; exit(0); I'm not able to find a way to identify files of pattern aaa* that are older than 7 days. Unix and Perl gurus, please help... regards, Arun |
| Bookmarks |
| Tags |
| mtime, perl net::ftp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|