Modifiaction time of file
- From: anu_subj_info@xxxxxxxxx (Anu P)
- Date: Fri, 28 Apr 2006 08:51:19 -0700 (PDT)
Hi,
I have a requirement where I need to look at the age
of file, if it's older than 2 days, I should remove
it.
I am trying to use the '-M ' filehandle in my script,
it does not work.
I get the following error
Use of uninitialized value in numeric gt (>) at
../temp_age.pl line 12.
#!/usr/bin/perl
use strict;
use warnings;
my $fail_dir =
"/home/anupamaperi/failed_tests/regress_26";
my ($file, $age);
opendir (DIR, $fail_dir) || die "cannot open, no
$fail_dir dir $!";
while ($file = readdir (DIR)) {
if (-M $file > 2) {
print("$file\n");
unlink($file);
}
}
Any ideas where am I going wrong?
Thanks,
Anu.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
.
- Follow-Ups:
- Re: Modifiaction time of file
- From: Mr. Shawn H. Corey
- Re: Modifiaction time of file
- From: John W. Krahn
- Re: Modifiaction time of file
- Prev by Date: Re: looping over an array of hashes
- Next by Date: RE: Modifiaction time of file
- Previous by thread: looping over an array of hashes
- Next by thread: Re: Modifiaction time of file
- Index(es):
Relevant Pages
|
|