static String printDirectoryTree(File folder) {
    if (!folder.isDirectory()) {
      throw new IllegalArgumentException("folder is not a Directory");
    }
    int indent = 0;
    StringBuilder sb = new StringBuilder();
    printDirectoryTree(folder, indent, sb);
    return sb.toString();
  }
Pretty print the directory tree and its file names.
geode-assembly/src/acceptanceTest/java/org/apache/geode/management/internal/cli/shell/DirectoryTree.java