Possible Duplicate:
Recursively list files in Java
I think File[] files = folder.listFiles() can only list the first level of files. Is there a way to list files recursively?
Possible Duplicate:
Recursively list files in Java
I think File[] files = folder.listFiles() can only list the first level of files. Is there a way to list files recursively?
Not a built-in one, but you can write a short recursive program to do walk the directory tree recursively.
void listAll(File dir, List<File> res) {
for (File f : dir.listFiles()) {
if (f.isDirectory()) {
listAll(f, res);
} else {
res.add(f);
}
}
}