X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0	tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Date: Mon, 14 May 2012 18:29:57 -0400
Message-ID: <CAPt61RQ7Cqm2h0wOE0EdqF712Gw7rBbSa+41ZQwG_y4E8JATsQ@mail.gmail.com>
Subject: problem with find's -size and -exec options
From: "j. k. colligan" <jkevinc@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=ISO-8859-1
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q4EMUvdL032331

Friends -

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!  (Plus the small ones at the
end of the list.)  This
surprised me.  In other similar cases I've run in the past, the
earlier-in-the-command-line
filters took effect before the exec.

The Linux version of "find" doesn't operate that way:  in the latter
case, only the "small"
files are passed to ls.  And if one replaces "-4000c" with "+4000c",
it works as I'd expect.

And yeah, I tried escaping that minus sign for the Cygwin shell, a la

    find . -size \-4000c -exec ls -l {} \;

Same unexpected (to me) result.  Am I way outta whack here, of is this
a real problem?
Thanks!

cheers,
j. kev
jkevinc@gmail.com
Monday, 2012.05.14 @ 1830 EDT

--
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


