List<String> (@NotNull URL root) { final List<String> paths = new ArrayList<>(); final File rootFile = new File(FileUtil.unquote(root.getPath())); new Object() { private void collectFiles(File fromFile, String prefix) { File[] list = fromFile.listFiles(); if (list == null) { return; } for (File file : list) { String childRelativePath = prefix.isEmpty() ? file.getName() : prefix + URL_PATH_SEPARATOR + file.getName(); if (file.isDirectory()) { collectFiles(file, childRelativePath); } else { paths.add(childRelativePath); } } } }.collectFiles(rootFile, ""); return paths; }