file timestamps and removal [was Re: SPUG:DOS / BASIC Script]
Michael R. Wolf
MichaelRunningWolf at att.net
Sat Jan 18 09:53:31 CST 2003
"Michael R. Wolf" <MichaelRunningWolf at att.net> writes:
[...]
> @too_old = grep { /^DB_trailings\.(\d+)\./ && $1 > $threshhold }
> glob("DB_trailings.*.*.txt");
# Of course, TMTOWTDI. These code frags look at the _real_ file
# timestamp instead of the same information _encoded_ in the filename.
# The reason I like the filename encoding is that it's not sensitive
# to touch(1) or someone accidently changing the timestamp while
# viewing it with their favorite editor. Of course, there's a case to
# be made that that touch(1) is important, and therefore worth
# preserving for another 2 weeks. If it weren't important for some
# reason, it wouldn't have been touched. It's your environment; you
# make the engineering decision.
@too_old = grep { (stat($_))[9] > $threshhold }
glob("DB_trailings.*.*.txt");
#or ================
use File::stat;
@too_old = grep { stat($_)->mtime > $threshhold }
glob("DB_trailings.*.*.txt");
#or ================
@too_old = grep { -M $_ > 14 }
glob("DB_trailings.*.*.txt");
TMTOWTDI-ily,
Michael
--
Michael R. Wolf
All mammals learn by playing!
MichaelRunningWolf at att.net
More information about the spug-list
mailing list