Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Deleting files

by welchavw (Pilgrim)
on Feb 02, 2004 at 15:49 UTC ( #325881=note: print w/replies, xml ) Need Help??


in reply to Deleting files

Mark,

You'll need to be a little clearer, since I can't tell if you want to delete files not modified within 5 days or those created more than five days from the present time. I'd guess that you mean modification time, in which case you'll need to look at the -M operator. Something like the following...

unlink map {-M $_ > 5 ? $_ : ()} <c:/foo/*>;

Regards,
welchavw

Update: Please see ysth's explanation below of why this simplistic logic is a non-starter for scripts that run for a long time.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://325881]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2016-09-30 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (565 votes). Check out past polls.