private static void visit(File file, FileVisitor fileVisitor) { if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { File f = files[i]; visit(f, fileVisitor); } } else { // regular file fileVisitor.visit(file); } }
/** * @param baseDir * @param fileVisitor */ public static void visitRecursively(File baseDir, FileVisitor fileVisitor) { visit(baseDir, fileVisitor); }