You may be able to use:

File dir = new FIle("c:\\directory");
File[] myFiles = dir.listFile(new MyFileFilter());

(The difference being the FileFilter.)

FileFilter is an interface which defines a single method called  
"accept" which simply returns a boolean indicating whether to add the  
file to the array or not.  I'm sure you could write an implementation  
which limits the number of files added to the array.  If nothing else,  
you can easily break them up alphabetically.

Christian

On Monday, July 7, 2003, at 04:59 AM, Craig Dudley wrote:

> The reason it's slow is that the directory contains so many files,  
> using
> java will probably be faster but it will still be awfully slow with a
> directory that has 120k + files in it. I don't think java file objects
> can be filtered to only choose the 1st 5k files, e.g.
>
> File dir = new File("c:\\directory");
> String files[] = dir.listFiles();
>
> This will return an array of ALL files in a directory, which would very
> probably be just about as slow as cfdirectory when the directory has
> that many files in it.
>
> It would however be fairly trivial to loop from 1 to files.length() and
> use file[index].renameTo(newDir) to move the files, but you still have
> the problem of retrieving the 120k + files into the array, which is
> where your speed problems come from.
>
> I'll whack together a test class for you if you want, but it may not
> help much. You would be better off looking at the process that creates
> the emails in the 1st place, perhaps it could create them in a new dir
> for every 5k emails, name the dirs something incremental, and then  
> every
> X minutes, move the content of the oldest dir into the smtp pickup dir.
> Should be a much faster approach but it I guess it all depends on  
> wether
> you have control over the process that creates the mails.
>
> Craig.
>
> -----Original Message-----
> From: Paul Hastings [mailto:[EMAIL PROTECTED]
> Sent: 04 July 2003 22:02
> To: CF-Talk
> Subject: Re: i need help on this
>
>
>> I think you didnt got it. I have to move 5000 at a time, not all of
>> them
> at
>> once.  That's why i'm having dificulty. I think i will look for some
>> exe
> to
>> help me on this.
>
> have you looked at any java to replace cfdirectory? plenty of examples
> in the java almanac:
> http://javaalmanac.com/egs/java.io/GetFiles.html?l=find
>
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to