void (File output, String outputRootPath, String relativePath) { File[] children = output.listFiles(); if (children == null) { myFileGeneratedEvent.add(outputRootPath, relativePath); } else { String prefix = relativePath.isEmpty() || relativePath.equals(".") ? "" : relativePath + "/"; for (File child : children) { addEventsRecursively(child, outputRootPath, prefix + child.getName()); } } }