http://www.perlmonks.org?node_id=659154

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 (Saint) 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