From owner-freebsd-questions@FreeBSD.ORG Thu Jul 23 07:21:37 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BC54106566B for ; Thu, 23 Jul 2009 07:21:37 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id E603F8FC14 for ; Thu, 23 Jul 2009 07:21:36 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n6N7LIGD060628; Thu, 23 Jul 2009 08:21:30 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk n6N7LIGD060628 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1248333690; bh=b0YP8FdngW3Pahl0UkPRDVe/AynttbOuRzFaqsajVYk=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4A680F67.7050300@infracaninophile.co.uk>|Date:=20T hu,=2023=20Jul=202009=2008:21:11=20+0100|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.22=20(X11/20090722)|MIME-Vers ion:=201.0|To:=20John=20Almberg=20|CC:=20fre ebsd-questions@freebsd.org|Subject:=20Re:=20limit=20to=20number=20 of=20files=20seen=20by=20ls?|References:=20|In-Reply-To:=20|X-Enigmail-Version:=200.95.6|Content-T ype:=20multipart/signed=3B=20micalg=3Dpgp-sha256=3B=0D=0A=20protoc ol=3D"application/pgp-signature"=3B=0D=0A=20boundary=3D"---------- --enigB5D8D18C78C45234E1563A51"; b=iZ19Z75p69FELTvFI1m3x1K1u3NsZJmzHtcYQGAG840A9n9mnR1jRsQBioJbdWiLL E/eYqcPQojnzFuiTWmW/enQDEq98BxDO1QrhSgQldkyhTiuRnL8CQ5J7Y5PX+FRuXc 614rUo19WHvagwaJTM/IdN7084JN+lbip+OFqK+8= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4A680F67.7050300@infracaninophile.co.uk> Date: Thu, 23 Jul 2009 08:21:11 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.22 (X11/20090722) MIME-Version: 1.0 To: John Almberg References: In-Reply-To: X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigB5D8D18C78C45234E1563A51" X-Virus-Scanned: clamav-milter 0.95.2 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: limit to number of files seen by ls? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2009 07:21:37 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB5D8D18C78C45234E1563A51 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable John Almberg wrote: > I seem to have run into an odd problem... >=20 > A client has a directory with a big-ish number of jpgs... maybe 4000.=20 > Problem is, I can only see 2329 of them with ls, and I'm running into=20 > other problems, I think. >=20 > Question: Is there some limit to the number of files that a directory=20 > can contain? Or rather, is there some number where things like ls start= =20 > working incorrectly? There's a limit to the number of arguments the shell will deal with for one command. So if you type: % ls -lh * (meaning the shell expands '*' to a list of filenames), you'll run into that limitation. However, if you type % ls -lh and let ls(1) read the directory contents itself, it should cope with 4000 items easily. [It might slow down because of sorting the results, but for only 4000 items that's probably not significant] Now, if your problem is that these 4000 jpegs are mixed up with other files and you only want to list the jpeg files, then you could do something like this: % find . -name '*.jpeg' -print0 | xargs -0 ls -lh or even just: % find . -name '*.jpg' -ls Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigB5D8D18C78C45234E1563A51 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkpoD24ACgkQ8Mjk52CukIx/fACdEiHHPhT2xHONIOZ6DU3ODo40 /GwAn25WyOcnN3pmCyY2uZBNO/9X+noq =sNqG -----END PGP SIGNATURE----- --------------enigB5D8D18C78C45234E1563A51--