Operating System - HP-UX
1753481 Members
4959 Online
108794 Solutions
New Discussion юеВ

Re: question about using find command

 
SOLVED
Go to solution
Mark Harshman_1
Regular Advisor

question about using find command

I am trying to use the mtime or ctime on a find command to only find files older then 4 hours in a specific directory. Can this be done with these options? or another way? this is on a HPUX 11i L RP8400 class server.
thanks
Never underestimate the power of stupid people in large groups
3 REPLIES 3
Stephen Keane
Honored Contributor

Re: question about using find command

Those find flags work on multiples of 24 hours, so a 4 hour timespan won't work.
Rodney Hills
Honored Contributor
Solution

Re: question about using find command

If you use the "touch" command to create a temp file with the exact date time of 4 hours ago, then you can use the -newer option.

example-

touch -t 200605030900 /tmp/testfile
find . ! -newer /tmp/testfile -print

HTH

-- Rod Hills
There be dragons...
Arturo Galbiati
Esteemed Contributor

Re: question about using find command

Hi Mark,
teh way to create a file by touch and using it to find file older than it it the good one.
But if you need to use it into a csript you have the problem to create file with timestamp of 4 hours ago.
Do to this you need or caljd script or mktime program in C.

Check out A. Clay's newest version of caljd.sh (and caljd.pl) at this thread.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1fb33a7b3682d611abdb0090277a
778c,00.html

HTH,
Art