Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 lurking in the Monastery: (5)
As of 2014-12-20 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls