find -exec oddity

Randall R Schulz rschulz@sonic.net
Tue Jul 8 02:32:00 GMT 2003


Ken,

At 16:38 2003-07-07, Ken Dibble wrote:
>Ok, I'm an idiot.  I've looked in the FAQ, searched the mail lists
>and checked sundry Unix sources (no, not the source code).

Well, I doubt greatly that you're an idiot. Confusion is the prelude to 
enlightenment, after all...

(Compare that with Eudora whose "mood watch" feature seems to think the 
first sentence of the previous paragraph is some kind of insult!)


However, we'd all appreciate it if you'd figure out how to use your 
mail client to make sure text attachments are not placed in-line with 
the message content. Not to do so defeats the purpose of attaching the 
"cygcheck" output, which is to make list searching meaningful by 
preventing the false hits that occur because of all the package and 
file names that are included in the cygcheck output.


>I can't make sense of this.
>
>$ find ./ -mtime -1  -print | wc -l
>    55
>
>$ find ./ -mtime -1 -ls | wc -l
>    55
>
>$ find ./ -mmin -1440 -ls | wc -l
>    55
>
>$ find ./ -mtime -1  -exec ls -l  '{}' \; | wc -l
>  2046

Look carefully at the man page for find where the "-ls" option is 
described. It says that "-ls" is equivalent to running "ls" with the 
options "-dils". The salient option here is "-d" which suppresses the 
listing of a directory's contents when a directory is an explicit 
argument to ls. You're not including "-d" in your invocation of ls, so 
every directory produced by find contributes its entire contents to the 
output of ls that is subsequently counted by "wc -l".


>$ find ./ -mtime -1  -exec ls -l  {} \; | wc -l
>  2046
>
>$ find ./ -mmin -1440  -exec ls -l  {} \; | wc -l
>  2046
>
>
>and just for grins....
>
>$ find ./ -print | wc -l
>31701
>
>$ find ./ -mtime -10 -print | wc -l
>   285
>
>$ find ./ -mtime -100 -print | wc -l
>15590
>
>The oddity (bug?) appears to be tied to -exec somehow.

No. The "-exec" option is doing just what you ask and just what it should.


>Attached is cygcheck -c -v -s.

As above.


>I can't attach the file lists (unpiped find output) as the message 
>size then exceeds 100K and the redhat mailserver bounces it.

No matter. It's not needed.


>Any help would be appreciated.

I hope my assumption about the problem is correct (file count 
discrepancies), since you didn't really say what it was that perplexed you.


>thanks,
>Ken


Randall Schulz 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list