[KLUG Members] find a file by date

Adam Tauno Williams adam at morrison-ind.com
Wed Dec 8 13:45:16 EST 2004


> rw-r--r--    1 user   staff        4136 Nov 19 2001 record5.dat
> I want something like the output of "find /usr/local -depth" for all
> files under /usr/local with dates of Nov 19 2001

Perhaps you could script something with "test" in bash.
--------------
16.3.3 File characteristic tests
-----infor corutils test---------------------------
                                                                                
These options test other file characteristics.
                                                                                
`-e FILE'
     True if FILE exists.
                                                                                
`-s FILE'
     True if FILE exists and has a size greater than zero.
                                                                                
`FILE1 -nt FILE2'
     True if FILE1 is newer (according to modification date) than
     FILE2, or if FILE1 exists and FILE2 does not.
                                                                                
`FILE1 -ot FILE2'
     True if FILE1 is older (according to modification date) than
     FILE2, or if FILE2 exists and FILE1 does not.
                                                                                
`FILE1 -ef FILE2'
     True if FILE1 and FILE2 have the same device an
----------

Roughly...

$REFERENCE_FILE=/abs/path/record5.dat
for FILE in `for /usr/local`
 do
  if [ "$FILE" -nt "$REFERENCE_FILE" ] 
    then
      echo "SUPSECT FILE:" $FILE
      echo "  " `ls -l $FILE`
    fi
  done



More information about the Members mailing list