Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private static List<File> findAllFiles(String baseDirectory) {
List<File> files = new LinkedList<File>();
List<File> directories = new LinkedList<File>();
directories.add(new File(baseDirectory));
while (!directories.isEmpty()) {
File [] subFiles = directories.remove(0).listFiles();
for (File f : subFiles) {
if (f.isDirectory()) {
directories.add(f);
} else {
files.add(f);
}
}
}
return files;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.