Summary: [Q] Find all files which been modified with 8 hours?

From: L (leed@chele.cais.net)
Date: Thu Dec 17 1998 - 20:51:45 CST


Thank you for so many people give me a hint. The summary are:

I. Regular SUN Solaris "find" command can NOT specify minute or hour. No
matter which option flag you use (-mtime, -ctime, -atime), they all base
on day. Some people mention their has option flag "-cmin", "-mmin", but
I can NOT find it under Solaris 2.5 and 2.6.

II. Most people suggest following way to solve this problem:

# touch -t MMDDhhmm file_name
# find . -newer file_name -print

        Where MMDDhhmm means Month, Day, Hour, Minute that you want the
files create, access, and modify times set to (like a point 8 hours earlier
than the current time). RTFM both touch and find for more details...

Mr. Douglas Palmer also provide a script to do that:

#!/usr/bin/ksh
typeset -Z2 BHOUR=0
typeset -Z2 NHOUR=0
CDAY=`date "+%m%d"`
NHOUR=`date "+%H"`
NMIN=`date "+%M"`
if [ $NHOUR -lt 8 ]
then
     let BHOUR=24-NHOUR
     let CDAY=CDAY-1
else
     let BHOUR=NHOUR-8
fi
BTIME=`echo $CDAY$BHOUR$NMIN`
touch -t $BTIME /tmp/acc$$
find . -newer /tmp/acc$$ -print
rm -f /tmp/acc$$

III. Some people suggest using GNU find (www.gnu.org), it support -mmin flag.
But their have couple of people mention GNU find buggy.

My original post:
>
> Is there has a way I can use "find" command to find all files that has
> been modified with 8 hours or been add within 8 hours?
>



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:53 CDT