Date: Thu, 23 Jul 2009 08:21:11 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: John Almberg <jalmberg@identry.com> Cc: freebsd-questions@freebsd.org Subject: Re: limit to number of files seen by ls? Message-ID: <4A680F67.7050300@infracaninophile.co.uk> In-Reply-To: <EACC9988-E37E-4F5F-AC03-8E664E015C3C@identry.com> References: <EACC9988-E37E-4F5F-AC03-8E664E015C3C@identry.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A680F67.7050300>
