file_tree 1.0.8 copy "file_tree: ^1.0.8" to clipboard
file_tree: ^1.0.8 copied to clipboard

Visualize the file tree of a directory.

Code on the Rocks

MIT License pub version

Developer BlogGitHub RepoPub.dev


file_tree #

Visualize the file tree of a directory 🌳

Installation #

dart pub global activate file_tree

Usage #

Output the file and directory tree of the current directory:

tree grow

Output:

├── LICENSE
├── test/
│  └── file_tree_test.dart
├── bin/
│  └── file_tree.dart
├── CHANGELOG.md
├── pubspec.lock
├── README.md

Output the file and directory tree using ASCII characters:

tree grow -a

Output:

+-- LICENSE
+-- test/
|  `-- file_tree_test.dart
+-- bin/
|  `-- file_tree.dart
+-- CHANGELOG.md
+-- pubspec.lock
+-- README.md

Output the file and directory tree and use emojis to indicate file type:

tree grow -e

Output:

├── 📄 LICENSE
├── 📁 test/
│  └── 📄 file_tree_test.dart
├── 📁 bin/
│  └── 📄 file_tree.dart
├── 📄 CHANGELOG.md
├── 📄 pubspec.lock
├── 📄 README.md

Limit the depth of the file tree (e.g., to 2 levels):

tree grow -d 2

Output:

├── LICENSE
├── test/
│  └── file_tree_test.dart
├── bin/
│  └── file_tree.dart
├── CHANGELOG.md
├── pubspec.lock
├── README.md

Include all files, ignoring .gitignore:

tree grow -A

Help #

(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

Options #

  • -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.

Examples #

Show tree with emojis, including hidden files, limited to 3 levels deep:

tree grow -e -i -d 3

Show ASCII tree of the first two directory levels:

tree grow -a -d 2

Show complete tree, including files that would normally be ignored by .gitignore:

tree grow -A

Show tree with emojis, including all files (ignoring .gitignore), and hidden files:

tree grow -e -A -i