From owner-freebsd-questions@FreeBSD.ORG Thu Jul 23 18:25:51 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 D40B61065672 for ; Thu, 23 Jul 2009 18:25:51 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id A1D048FC16 for ; Thu, 23 Jul 2009 18:25:51 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 00D587E818 for ; Thu, 23 Jul 2009 10:25:50 -0800 (AKDT) From: Mel Flynn To: freebsd-questions@freebsd.org Date: Thu, 23 Jul 2009 10:25:49 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA2; KDE/4.2.4; i386; ; ) References: <20090723174126.9AFF7B7DE@kev.msw.wpafb.af.mil> In-Reply-To: <20090723174126.9AFF7B7DE@kev.msw.wpafb.af.mil> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200907231025.49916.mel.flynn+fbsd.questions@mailing.thruhere.net> 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 18:25:52 -0000 On Thursday 23 July 2009 09:41:26 Karl Vogel wrote: > >> On Wed, 22 Jul 2009 20:01:57 -0400, > >> John Almberg said: > > J> A client has a directory with a big-ish number of jpgs... maybe 4000. > J> Problem is, I can only see 2329 of them with ls, and I'm running into > J> other problems, I think. > > J> Question: Is there some limit to the number of files that a directory > J> can contain? Or rather, is there some number where things like ls start > J> working incorrectly? > > Every version of Unix I've ever used had an upper limit on the size > of the argument list you could pass to a program, so it won't just be > "ls" that's affected here. That's why I use 1,000 as a rule of thumb > for the maximum number of files I put in a directory. That arbitrary number works simply because kern.argmax default has been raised somewhere in 6.x (before it was 64kB). % echo `sysctl -n kern.argmax`/1000|bc 262 And MAXNAMLEN in sys/dirent.h is 255. Knowing your way around maximum arguments length through xargs as suggested in this thread is much better solution then trying to exercise control over directory sizes, which may or not be under your control in the first place. -- Mel