Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jim Janney Newsgroups: comp.lang.java.programmer Subject: Re: The first 10 files Date: Sat, 26 Jan 2013 17:13:19 -0700 Organization: hexadecimal loadlifters Lines: 41 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="3c5d835c9a0219e1946f4dd3740c28b0"; logging-data="31461"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2qUOs9b64NkgLqeMzM11h" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:G1WHebwZgc1bP5dORANFlHaIlsI= sha1:kUuirWuOVHMwtCrxkwyEdTMr7+w= Xref: csiph.com comp.lang.java.programmer:21762 Wojtek writes: > John B. Matthews wrote : >> Although it may be beyond your control, you should also critically >> assess a design having tens of thousands of files in a single >> directory. > > Well of course. > > The directory holds files which are uploaded by external events. If > there are a lot of events between application runs, then the number of > files can indeed reach large numbers. > > Since this is happening on a server, and you cam potentially have many > hundreds of people accessing at the same time (each with there own > directory), I was hoping to be able to "stage" file processing. > > The: > > public boolean accept(File pathname) { > return maxFiles-- > 0; > } > > in FileFilter is interesting, but the file system nevertheless still > runs through the entire directory. Maybe FileFilter needs: > > public boolean abort(File pathname); > > Hmm, maybe I need a timed background process to move files to > "holding" directories which will be limited to a small number of > files. You could run a command in a subprocess. On a Unix system ls -U | head -n 10 should run quickly (-U tells it not to sort). Not sure how to do that on Windows. -- Jim Janney