When I have a need like this, I think of find2perl. If you look at the man page for find, you see that there is a way to list files newer than a date or another file. Say you keep a file called 'lasttime' that you modify the last time yo run your check...

find2perl /mydir -type f -newer lasttime -print > find-recent-files.pl

gets you some perl that is close to what you want, and you can change the strings '/mydir' and 'lasttime' to command line input.

#! /opt/local/bin/perl -w eval 'exec /opt/local/bin/perl -S $0 ${1+"$@"}' if 0; #$running_under_some_shell use strict; use File::Find (); use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; sub wanted; my $timefile = shift; my $rootdir = shift; (-e "$timefile") or die "$0 : last mod time file \"$timefile\" does no +t exist\n"; (-d "$rootdir") or die "$0 : directory \"$rootdir\" for search does no +t exist\n"; my $AGE_OFlasttime = -M "$timefile"; # Traverse desired filesystems File::Find::find({wanted => \&wanted}, "$rootdir"); exit; sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -f _ && (-M _ < $AGE_OFlasttime) && print("$name\n"); }

In reply to Re: Checking for files changed by dwhite20899
in thread Checking for files changed by richill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.