private static void printDirectoryTree(File folder, int indent, StringBuilder sb) {
    if (!folder.isDirectory()) {
      throw new IllegalArgumentException("folder is not a Directory");
    }
    sb.append(getIndentString(indent));
    sb.append("+--");
    sb.append(folder.getName());
    sb.append("/");
    sb.append(lineSeparator());
    for (File file : folder.listFiles()) {
      if (file.isDirectory()) {
        printDirectoryTree(file, indent + 1, sb);
      } else {
        printFile(file, indent + 1, sb);
      }
    }
  }
Pretty print the directory tree and its file names.
geode-assembly/src/acceptanceTest/java/org/apache/geode/management/internal/cli/shell/DirectoryTree.java