On 10/1/2012 4:59 PM, Kaz Kylheku wrote:
> On 2012-10-01, Lem Novantotto <Le...@Hotmail.com> wrote:
>> jammer ha scritto:
>>
>>> I thought these would be the same but the first one finds files but the
>> second doesn't.
>>>
>>> $ find . -name \* -size 1M
>>> $ find . -name \* -size 1024k
Neither "k", "K", "m", or "M" are standard, so you need to read your
find command's man page to see how it handles that.
"-size n" is true if the file size in bytes, divided by
512 and rounded up to the next integer, is n. To use bytes,
use "-size 1048576c". To find files bigger than that, use
"-size +1048576c". To find files smaller than that, use
"-size -1048576c".
>>
>> 1M means 1 *single* unit (of 1048576 bytes).
>
> Another thing: maybe the OP thinks that "-name \*" matches all names?
>
> This predicate actually means "match all directory entries whose name does not
> begin with a dot".
No, it does match all names, including dot files. But you're right that it
should be excluded, since it does nothing.
>
> To find files regardless of name, simply do not include a -name predicate.
>
If the intent was to ignore any dot files, and to not look in hidden directories
either, then something like this will work:
find \( -type d -name '.[!.]*' -prune \) \
-o \( ! -type d -name '[!.]*' \) \
-size whatever -print
--
Wayne