Developer Blog • GitHub Repo • Pub.dev
Visualize the file tree of a directory 🌳
dart pub global activate file_treeOutput the file and directory tree of the current directory:
tree growOutput:
├── LICENSE
├── test/
│ └── file_tree_test.dart
├── bin/
│ └── file_tree.dart
├── CHANGELOG.md
├── pubspec.lock
├── README.mdOutput the file and directory tree using ASCII characters:
tree grow -aOutput:
+-- LICENSE
+-- test/
| `-- file_tree_test.dart
+-- bin/
| `-- file_tree.dart
+-- CHANGELOG.md
+-- pubspec.lock
+-- README.mdOutput the file and directory tree and use emojis to indicate file type:
tree grow -eOutput:
├── 📄 LICENSE
├── 📁 test/
│ └── 📄 file_tree_test.dart
├── 📁 bin/
│ └── 📄 file_tree.dart
├── 📄 CHANGELOG.md
├── 📄 pubspec.lock
├── 📄 README.mdLimit the depth of the file tree (e.g., to 2 levels):
tree grow -d 2Output:
├── LICENSE
├── test/
│ └── file_tree_test.dart
├── bin/
│ └── file_tree.dart
├── CHANGELOG.md
├── pubspec.lock
├── README.mdInclude all files, ignoring .gitignore:
tree grow -A(tree grow -h)
Print out a file tree for the current directory.
Usage: tree grow [arguments]
-a, --ascii Use only ASCII characters to draw the tree.
-e, --emojis Add emojis to the tree to indicate file types.
-i, --include_hidden Include hidden files in the tree
-d, --depth Set the maximum depth of the tree (default: -1, no limit)
-A, --all Include all files, ignoring .gitignore-a, --ascii: Use ASCII characters for the tree structure instead of Unicode characters.-e, --emojis: Add emojis to indicate file types (📁 for directories, 📄 for files).-i, --include_hidden: Include hidden files and directories in the tree.-d, --depth: Set the maximum depth for the tree. Use -1 for unlimited depth (default).-A, --all: Include all files, ignoring .gitignore rules.
Show tree with emojis, including hidden files, limited to 3 levels deep:
tree grow -e -i -d 3Show ASCII tree of the first two directory levels:
tree grow -a -d 2Show complete tree, including files that would normally be ignored by .gitignore:
tree grow -AShow tree with emojis, including all files (ignoring .gitignore), and hidden files:
tree grow -e -A -i