Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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.


Comment on Re: Deleting files
Download Code

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 having an uproarious good time at the Monastery: (6)
As of 2014-10-25 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls