StringBuilder (@NotNull VirtualFile from, int level, @NotNull StringBuilder builder) { List<VirtualFile> children = new ArrayList<>(((NewVirtualFile)from).getCachedChildren()); Collections.sort(children, Comparator.comparing(VirtualFile::getName)); for (VirtualFile eachChild : children) { builder.append(StringUtil.repeat(" ", level)).append(eachChild.getName()).append("\n"); buildDBFileStructure(eachChild, level + 1, builder); } return builder; }