Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I want to list the files only created by today.I am using find. -mtime -0 -print.But it is showing the files created by yesterday also.See the input file,
-rw-r--r-- 1 virtual virtual 1662 Jun 28 22:20 busy-5900.log -rw-r--r-- 1 virtual virtual 54964 Jun 28 22:40 busy-5923.log -rw-r--r-- 1 virtual virtual 538 Jun 28 23:00 busy-5929.log -rw-r--r-- 1 virtual virtual 54963 Jun 28 23:40 busy-5940.log -rw-r--r-- 1 virtual virtual 538 Jun 29 00:00 busy-5945.log -rw-r--r-- 1 virtual virtual 1662 Jun 29 00:20 busy-5934.log -rw-r--r-- 1 virtual virtual 54961 Jun 29 00:40 busy-5955.log
Here I want to get only the files created by Jun 29.How can i do this.
Thanks a lot in advance.

Considered by Corion: Reap: No perl content
Unconsidered by planetscape: keep (and edit) votes prevented reaping ( keep:6 edit:3 reap:17 )

Replies are listed 'Best First'.
Re: Find files by current date
by jwkrahn (Abbot) on Jun 28, 2006 at 21:36 UTC
    #!/usr/bin/perl use warnings; use strict; ( my $today = localtime ) =~ s'\d+:\d+:\d+'\d+:\d+:\d+'; for ( <*> ) { print "$_\n" if localtime( ( stat )[ 9 ] ) =~ $today; }
      Hi,
      What you told is working for me in the local server.If i want to run the same command in remote server using telnet how i have to do it.
      Please let me know.
      Thank You.
Re: Find files by current date
by ikegami (Patriarch) on Jun 28, 2006 at 20:49 UTC

    Start with File::Find or File::Find::Rule, probably the latter.

    If you wish to do it using find, this is not the place to ask. This is a Perl support site. It would be acceptable to ask in the ChatterBox, however. (You must be logged in to use the ChatterBox.)