Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you look at the <a href="http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=co" rel="noreferrer">source code</a> and read between the lines in the JavaDoc, you will see that -- unfortunately -- this API is not designed to do what you want. It will return a list of <strong>files</strong> (not a list of <strong>files and directories</strong>) that match the provided arguments. In the source code -- look at the method <code>innerListFiles</code> -- you will see that directories are searched and <em>not</em> added to the result list.</p> <p>I am not aware of any public API that will do what you want. Hopefully someone else will know of one. Most will probably be a DFS, not a BFS, which may or may not matter for your purposes. (So far, <em>all</em> Java code I've ever looked at that did a directory tree traversal did it via a depth-first search. Which doesn't mean that BFS's aren't out there, of course.)</p> <p>If you really want a list of <strong>everything</strong> under a given directory, it's easy enough to roll your own. But I understand your wish to not reinvent the wheel.</p> <p>Note: It's possible that <a href="http://commons.apache.org/sandbox/finder/" rel="noreferrer">Apache Commons Finder</a> will support what you need, but this library is in The Commons Sandbox, which means it is more experimental at this stage. It may or may not be complete and it may or may not be maintained. It also may be heavyweight for what you are looking for.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload