void (File file, Consumer<File> processor, int depth) { if (depth == 0 || isInSpecialMacFolder(file.getPath())) return; processor.accept(file); File[] files = file.listFiles(pathname -> !pathname.getName().startsWith(".")); if (files == null) return; for (File child : files) { visitFiles( child, processor, depth - 1); } }