Skip to content

--sort

Info

The --sort flag controls how files and directories are sorted before displaying the tree.

Usage

Usage

Sort By Name
show-file-tree  --sort name
Sort By Size
show-file-tree  --sort size

Abstract

  • name — Sort alphabetically (default).
  • size — Sort by file or folder size (smallest → largest).

Examples

Sort by {name, order}

Command
show-file-tree .
Output (simplified)
├── 📁 docs
├── 📁 src
└── 📄 README.md

Command
show-file-tree . --sort size
Output (simplified)
└── 📄 README.md (25 KB)
├── 📁 src (100 KB)
└── 📁 docs (200 KB)

Tip

Tip

You can combine --sort with --order to control ascending/descending order.