You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Aaron Ehrensberger <ae...@docfinity.com> on 2009/05/26 15:28:27 UTC

Directory Walker speed

Hi,

 

I've done some testing with the DirectoryWalker API and found some
curious results and am wondering if someone else could confirm my
suspicions.

 

I have two scenarios, working with 5000 files....

 

Scenario 1

Multiple file types, stored relative to a high level directory, such
that...

c:\images\2009\05\26\03\filename\jpg

c:\audio\2009\05\26\03\filename\audioFile

c:\video\2009\05\26\03\filename\videoFile

 

Scenario 2

Mulitple file types, all stored as subdirectories of a certain date/time
directory tree, such that...

c:\2009\05\26\03\filename\images\jpg

c:\2009\05\26\03\filename\audio\audioFile

c:\2009\05\26\03\filename\video\videoFile

 

Now, the goal is to delete all images.  I would have expected that
simply blowing away the top level directory c:\images, which would then
delete the entire directory and all the image files, would be the faster
way to go.  But, my timings have shown that using a DirectoryWalker to
traverse all the directories in scenario 2 turns out to be quicker.  My
suspicion is because the amount of directory deletions is actually lower
in the 2nd scenario, as we don't have to recursively delete all the
subdirectories in order to get to the images directory.

 

I haven't been able to find any documentation yet to prove my suspicions
though.  Can anybody confirm that this is truly what is happening?

 

Thanks,

Aaron

 

 

Aaron Ehrensberger

Software Architect

DocFinity(r) by Optical Image Technology, Inc.

100 Oakwood Avenue, State College, PA  16803

ph: 814.238.0038 ext. 270

fax: 814.238.0011

email: aehrensberger@docfinity.com

web: www.docfinity.com