Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Get file names between two timestamps on Unix/Linux

by perlCrazy (Monk)
on Dec 27, 2007 at 05:47 UTC ( #659154=perlquestion: print w/replies, xml ) Need Help??
perlCrazy has asked for the wisdom of the Perl Monks concerning the following question:

Want to develop a application which will provide a list of files between two timestamps and have the ability to view the same via web.
one option is to use find command but trying to avoid this, is there any better way to accomplish this in perl?
Any suggestions will be great help.
Thanks
  • Comment on Get file names between two timestamps on Unix/Linux

Replies are listed 'Best First'.
Re: Get file names between two timestamps on Unix/Linux
by GrandFather (Sage) on Dec 27, 2007 at 07:07 UTC

    It may be that File::Find::Rule's mtime or ctime will get you where you want to go. Something like (untested):

    my @files = File::Find::Rule->file () ->name ('*.pl') ->ctime(">=$startTime") ->ctime("<$endTime") ->in (@INC);

    Perl is environmentally friendly - it saves trees
Re: Get file names between two timestamps on Unix/Linux
by HeatSeekerCannibal (Beadle) on Dec 28, 2007 at 16:15 UTC
    You could also go the very long way and use the opendir and stat functions. You would learn more, but the File::Find module its definitely easier.

    Best of luck!

    Heatseeker Cannibal

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://659154]
Approved by ww
help
Chatterbox?
[1nickt]: Corion I assume you are talking about Retry? Attempt doesn;t offer callbacks and has a much simpler interface. (Also written by someone I trust...)
[perldigious]: I train for long portaging/rowing trips by carrying my kayak to the river about a half mile from my house 2-3 times a week depending on weather... but due to a lingering winter, I haven't had long to train this year.
[erix]: Ah, I found the link for my run: 6km (and 6km back)
[perldigious]: Also, made the unhappy discovery that the ticks have become active already this year... I really, really hate ticks.

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2017-05-24 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?