Skip to content

List contents of directories in a tree-like format with colorization and lots of options

License

Notifications You must be signed in to change notification settings

posh-projects/Tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tree

Powershellgallery Badge

List contents of directories in a tree-like format with colorization and lots of options.

example 03

I frequently need a tree-style directory listing charts to include in my GitHub doc files. But the native windows tree.com implementation is far from perfect, and the Linux clone Tree for Windows renders the tree with legacy ASCII characters. So I decided to spend a couple of hours to write this wrapper with color highlighting and proper leafs rendering support.

This module uses Tree for Windows in order to get the initial directory structure and then colorizes its output and renders the unicode representation.

Make sure to download the Tree for Windows and make it accessible through your system PATH variable Install via Chocolatey: cinst tree

Get-ChildItemTree Understands all of its Linux tree counterpart, command line switches. So, feel free to read the official docs for more info.

Install

PS> Install-Module Tree

If you want the alias tree to work properly, add Import-Module Tree to your Powershell profile config.

Use Get-ChildItemTree --help for help.

  • The path is optional
  • Network paths supported \\server.local\Path
# Generate the tree
# -a include hidden files
# -I exclude .git folder
PS>Get-ChildItemTree D:\Path -a -I .git

example 01

.
├── FolderOne
│   ├── LICENSE
│   ├── archive.rar
│   └── text.txt
├── FolderThree
│   ├── FolderTwo
│   │   ├── SRC
│   │   │   ├── picture.png
│   │   │   └── unknown.yyy
│   │   ├── executable.ps1
│   │   └── unknown.yyy
│   └── text.md
└── FolderTwo
    ├── InnerFolder
    │   └── unknown.yyy
    ├── executable.ps1
    └── unknown.yyy
# -h Print the size of each file in a human readable way
# -p Print the file type and permissions for each file
Get-ChildItemTree D:\Path -a -h -p

example 02

About

List contents of directories in a tree-like format with colorization and lots of options

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published