What is the most efficient way to list all of the files in a directory (including sub-directories)?

Posted by prometheus on Stack Overflow See other posts from Stack Overflow or by prometheus
Published on 2010-03-19T18:56:06Z Indexed on 2010/03/19 19:11 UTC
Read the original article Hit count: 231

Filed under:
|
|
|
|

I am writing a servlet which will examine a directory on the server (external to the web container), and recursively search for certain files (by certain files, I mean files that are of a certain extension as well as a certain naming convention). Once these files are found, the servlet responds with a long list of all of the found files (including the full path to the files). My problem is that there are so many files and directories that my servlet goes extremely slow. I was wondering if there was a best practice or existing servlet for this type of problem? Would it be more efficient to simply compile the entire list of files and do the filtering via js/jquery on the client side?

© Stack Overflow or respective owner

Related posts about servlet

Related posts about java