@Override
                            public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
                                cleanProgress.addDir();
                                // Remember the dir age.
                                final Instant instant = Instant.ofEpochMilli(attrs.lastModifiedTime().toMillis());
                                dirAges.put(dir, instant);

                                // The parent dir has child dirs so we won't be considering the dir for deletion.
                                final Path parent = dir.getParent();
                                if (parent != null) {
                                    dirAges.remove(parent);
                                }

                                return super.preVisitDirectory(dir, attrs);
                            }
API used by the tasks to interface to the stream store under the bonnet.
stroom-data/stroom-data-store-impl-fs/src/main/java/stroom/data/store/impl/fs/FsOrphanFileFinder.java