Operating System - HP-UX
1752782 Members
6125 Online
108789 Solutions
New Discussion юеВ

find command does not find all files ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

find command does not find all files ?

Any idea, why the below find command only find 4 files , but there aare lot more *arc files. I was expecting the command to find all *arc files older than 1 day. ?


-rw-r----- 1 oracle dba 20970496 Nov 24 10:34 MASSP_229285.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 10:42 MASSP_229286.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 10:44 MASSP_229287.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 10:47 MASSP_229288.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 10:50 MASSP_229289.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 10:54 MASSP_229290.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 10:59 MASSP_229291.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:05 MASSP_229292.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:22 MASSP_229293.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:24 MASSP_229294.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:26 MASSP_229295.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:30 MASSP_229296.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:36 MASSP_229297.arc
-rw-r----- 1 oracle dba 20968448 Nov 24 11:40 MASSP_229298.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:45 MASSP_229299.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 11:56 MASSP_229300.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 12:01 MASSP_229301.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 12:09 MASSP_229302.arc
-rw-r----- 1 oracle dba 20969472 Nov 24 12:14 MASSP_229303.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 12:36 MASSP_229304.arc
-rw-r----- 1 oracle dba 20969472 Nov 24 13:06 MASSP_229305.arc
-rw-r----- 1 oracle dba 20970496 Nov 24 13:34 MASSP_229306.arc
-rw-r----- 1 oracle dba 20969472 Nov 24 14:12 MASSP_229307.arc
drwxr-s--- 2 oracle dba 20480 Nov 24 15:17 .
-rw-r----- 1 oracle dba 20970496 Nov 24 15:17 MASSP_229308.arc
magic:/app/oracle/admin/MASSSTB/arch1 ==> uname -a
HP-UX magic B.11.11 U 9000/800 261757805 unlimited-user license
# find . -follow -name '*.arc' -ctime +1
./MASSP_228961.arc
./MASSP_228962.arc
./MASSP_228963.arc
./MASSP_228964.arc
#
good judgement comes from experience and experience comes from bad judgement.
6 REPLIES 6
Sammy_2
Super Advisor

Re: find command does not find all files ?

Actually, it only finds the 1st 5 files although I have more.

magic:/app/oracle/admin/MASSSTB/arch1 ==> ls -altr
total 14143018
drwxrws--- 8 oracle dba 1024 May 26 2009 ..
-rw-r----- 1 oracle dba 20970496 Nov 22 15:09 MASSP_228961.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 15:15 MASSP_228962.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 15:22 MASSP_228963.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 15:30 MASSP_228964.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 15:37 MASSP_228965.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 15:45 MASSP_228966.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 15:52 MASSP_228967.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 15:58 MASSP_228968.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:04 MASSP_228969.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:09 MASSP_228970.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:17 MASSP_228971.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:23 MASSP_228972.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:30 MASSP_228973.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:38 MASSP_228974.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:45 MASSP_228975.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 16:53 MASSP_228976.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 17:01 MASSP_228977.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 17:07 MASSP_228978.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 17:12 MASSP_228979.arc
-rw-r----- 1 oracle dba 20970496 Nov 22 17:19 MASSP_228980.arc
good judgement comes from experience and experience comes from bad judgement.
Steven Schweda
Honored Contributor

Re: find command does not find all files ?

> [...] I was expecting the command to find
> all *arc files older than 1 day. ?

Then why are you using "-ctime"?

man find

Compare "-atime", "-ctime", and "-mtime".
(Consider also "-newer" and its friends.)
James R. Ferguson
Acclaimed Contributor

Re: find command does not find all files ?

Hi:

A couple of comments to guide you. Don't confuse 'ctime' with the concept of a creation timestamp. Unix doesn't maintain a creation time; only a last-modification ('mtime'). This is what 'ls -l' is reporting.

Your 'find' with a '-ctime' is looking for changes (that "c") in permission, ownership or name, _not_ modifications to the file or directory contents.

The notation '-ctime +1' means that the 'ctime' is older than 'n-1' to 'n' 24-hour intervals. Hence if you use this, you may not see all files for a particular day. This is the reason Steven suggested the use of '-newer' where the reference point is made against another file with a known timestamp (usually a temporary file that you create with 'touch' and explicitly set its 'mtime).

Have a good, careful look at the 'find(1)' manpages together with those for 'stat(5)'.

Regards!

...JRF...
Steven Schweda
Honored Contributor

Re: find command does not find all files ?

> Have a good, careful look [...]

Or even a quick, sloppy look at any of the
many, many "find"-related threads which a
simple Forum search should find.
Dennis Handly
Acclaimed Contributor
Solution

Re: find command does not find all files ?

>JRF: The notation '-ctime +1' means that the 'ctime' is older than 'n-1' to 'n' 24-hour intervals.

If you remember previous threads, the find(1) documentation is broken, so that's only true if you use:
UNIX95=FIDDLE_WITH_FIND_TIMES find ... -ctime +1 ...

If you don't set UNIX95, -ctime +1 would mean 48 or longer.
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1306285
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1271016
Sammy_2
Super Advisor

Re: find command does not find all files ?

Steven, I understand newer would work but that requires you to create a file everytime before running the command. But definitely a nice suggestion. Thanks Steve

JRF,
Informative as ever with your 2 cents. Appreciate it your invaluable ideas.

Dennis,
Right on the money. Although, JRF and Steve had me on the right path with newer command but I find
the easiest thing to do is just add UNIX95 variable and then let find command rip. It worked . thanks
good judgement comes from experience and experience comes from bad judgement.