I am trying to write a script that opens a directory on an HPUX 11.11 system, reads the directory and skips files that do not meet my regex, and then for all files that pass the regex, delete any file older than 90 days. I have been playing with the "-C" file test but it returns a number like "1072724171" which is the same for all the files it finds, even though I know only one file is created every day. Here is my code so far:
#!/opt/perl/bin/perl -w
use strict;
use vars qw($dirname @allfiles $file $day $month $year $created);
$dirname = "/tmp"; # This is a directory where data can be found
opendir(DIR,"$dirname"
@allfiles = readdir DIR;
foreach $file (@allfiles) {
next unless ($file =~ /^h\d+\.\d+/);
#$^T=time;
$created = (-C $file);
print "$^T\n";
}
Any help is appriciated.
Nick
#!/opt/perl/bin/perl -w
use strict;
use vars qw($dirname @allfiles $file $day $month $year $created);
$dirname = "/tmp"; # This is a directory where data can be found
opendir(DIR,"$dirname"
@allfiles = readdir DIR;
foreach $file (@allfiles) {
next unless ($file =~ /^h\d+\.\d+/);
#$^T=time;
$created = (-C $file);
print "$^T\n";
}
Any help is appriciated.
Nick