Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How do I determine if a file was modified today?

by ton (Friar)
on Jun 02, 2001 at 12:45 UTC ( [id://85184]=note: print w/replies, xml ) Need Help??


in reply to How do I determine if a file was modified today?

If by "today" you mean "in the last 24 hours", try this:
if (1 > -M $filename) { # Your code here }

-----
Be bloody, bold, and resolute; laugh to scorn
The power of man...

Replies are listed 'Best First'.
Re: Re: How do I determine if a file was modified today?
by clintp (Curate) on Jun 02, 2001 at 17:30 UTC
    Nice and concice. If the poster meant "in the last 24 hours" to mean this calendar day, let's combine this concise answer with some of the others above:
    if ( 1 > -M $file and (localtime((stat _)[9]))[3] == (localtime)[3] ) { # modified "in the last 24 hours" }
    Beware of small, subtle bugs around Daylight Savings time.

Log In?
Username:
Password:

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

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

    No recent polls found