Collection<String> (@NotNull String root) { final List<String> roots = new SmartList<>(); roots.add(root); FileUtil.processFilesRecursively(new File(root), file -> { try { String path = file.getCanonicalPath(); if (!FileUtil.isAncestor(path, path, false)) { roots.add(path); } } catch (IOException ignore) { } return true; }); return roots; }