private void
listFilesInDirectoryRecursively(String path) {
File main = new File(path);
if
(main.isDirectory()) {
String[]
filename = main.list();
for (int i = 0; i <
filename.length; i++) {
File
sub = new File(main.getAbsoluteFile() + File.separator + filename[i]);
if
(sub.isDirectory()) {
this.listFilesInDirectoryRecursively(main.getAbsoluteFile() + File.separator + filename[i]);
} else {
System.out.println(sub.getAbsoluteFile());
}
}
} else {
System.out.println(main.getAbsoluteFile());
}
}
沒有留言:
張貼留言