"find" command to find file on specific date?

"find" command to find file on specific date?

Post by Pisut Tranchindavong - SCCS - 37371 » Wed, 03 Apr 1996 04:00:00



Hi,
   Does anyone please tell how unix find command find a file on specific date?
Ex: find . -date 960331 -print

Regard,
Pisut T.

 
 
 

"find" command to find file on specific date?

Post by Bert Hym » Wed, 03 Apr 1996 04:00:00




Quote:>   Does anyone please tell how unix find command find a file on specific date?
>Ex: find . -date 960331 -print

The only date-related commands in the version of find on the SVR4 systems
I have access to are:

-atime n        # accessed 'n' days ago
-mtime n        # data modified 'n' days ago
-ctime n        # status changed 'n' days ago
-newer file     # modified mreo recently than 'file'

but, of course, you know this because you read the man pages, right?
--
The opinions expressed in this message are my own and are not the opinions of
anyone who does not hold those opinions.

Bert Hyman | Unisys - Roseville MN

 
 
 

"find" command to find file on specific date?

Post by Tom Sande » Sun, 07 Apr 1996 04:00:00



|> Hi,
|>    Does anyone please tell how unix find command find a file on specific date?
|> Ex: find . -date 960331 -print
|>
|> Regard,
|> Pisut T.
|>

I wrote 2 simple scripts that will find files before a specified time/date
or after a specified time/date.  I don't have time right now, but they
can easily be combined to yield a specific date.

Hope they help,
Tom Sanders

######################################################

#!/bin/sh
if [ "$1" = "" ]
then echo "Usage: find.after date(YYMMDDhhmm format)   directory-path(optional)"
     exit 5
fi

xdate=$1
shift
if [ "$*" = "" ] ;then
    dir='.'
else
    dir=$*
fi

touch -t $xdate /tmp/TODAYS_DATE$$
find $dir -newer /tmp/TODAYS_DATE$$ -xdev -type f -print
rm /tmp/TODAYS_DATE$$

######################################################

#!/bin/sh
if [ "$1" = "" ]
then echo "Usage: find.before date(YYMMDDhhmm format)   directory-path(optional)"
     exit 5
fi

xdate=$1
shift
if [ "$*" = "" ] ;then
    dir='.'
else
    dir=$*
fi

touch -t $xdate /tmp/TODAYS_DATE$$
find $dir -newer /tmp/TODAYS_DATE$$ -xdev -type f -print |sort >/tmp/NEW_FILES$$
find $dir -xdev -type f -print|sort  >/tmp/ALL_FILES$$
comm -3 /tmp/ALL_FILES$$ /tmp/NEW_FILES$$

rm /tmp/TODAYS_DATE$$ /tmp/ALL_FILES$$ /tmp/NEW_FILES$$
######################################################