problem with find's -size and -exec options

René Berber r.berber@computer.org
Mon May 14 22:53:00 GMT 2012


On 5/14/2012 5:29 PM, j. k. colligan wrote:

> I just noticed a difference in behavior between Cygwin's "find" and
> the one in Linux, or
> so it seems.
>
> I was trying to locate files smaller than a given size, and thus ran
>
>      find . -size -4000c
>
> That worked, and listed the file names only for files<  4000 bytes in
> size.  But if I run
>
>      find . -size -4000c -exec ls -l {} \;
>
> it turns out that *all* files are listed!

Looks like the problem is that find returns directories.

Try "find -type f -size -4000c -ls"

(yes, find already has ls built in, no need to use exec).
-- 
René Berber


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



More information about the Cygwin mailing list