Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How do I delete files based on their timestamp?

by reptile (Monk)
on May 09, 2000 at 00:35 UTC ( [id://10662]=note: print w/replies, xml ) Need Help??


in reply to How do I delete files based on their timestamp?

Or use perlfunc:stat from within perl. It'll give you just about everything you wanted to know about a file and more. The times returned are in seconds-since-epoch format just like time() so a little arithmetic and a comparison is all you need.

# delete $file if it's not been modified for 3 hours if ( (stat $file)[9] < time() - (3600 * 3) ) { unlink $file; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-24 12:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found