private static int collectPaths(final File parent, final List<String[]> pathList, final String[] scratch, final int depth) {
        if (depth == scratch.length) {
            // directory hierarchy is too deep
            return 0;
        }

        final File[] files = parent.listFiles();
        for (final File f : files) {
            if (!f.isHidden()) {
                final String name = f.getName();
                scratch[depth] = name;
                if (f.isDirectory()) {
                    collectPaths(f, pathList, scratch, depth + 1);
                } else {
                    final int i = name.lastIndexOf('.');
                    if (i > 0) {
                        final String ext = name.substring(i).toLowerCase();
                        if (".tif".equals(ext) || ".tiff".equals(ext)) {
                            final String[] temp = Arrays.copyOf(scratch, depth + 1);
                            pathList.add(temp);
                        }
                    }
                }
            }
        }
        return depth;
    }
Recursively search the specified path and list TIFF files and metadata.
<p>
Command-line Arguments:
</p>
<ol>
<li>Top-level directory (mandatory)</li>
<li>Output file for results (optional)</li>
</ol>
If the optional output file has the extension ".csv", the output will be formatted as a comma-separated-value file suitable for inspection in Excel.
src/test/java/org/apache/commons/imaging/examples/tiff/SurveyTiffFolder.java