I am trying to get full structure of my project in tree format in powershell.
When I use the command tree, it only shows directories and subdirectories, but neither files nor hidden folders, such as .git
How can I show files as well?
Thank you
I am trying to get full structure of my project in tree format in powershell.
When I use the command tree, it only shows directories and subdirectories, but neither files nor hidden folders, such as .git
How can I show files as well?
Thank you
Copyright © 2021 Jogjafile Inc.
tree.com:does have an option to include files in the output:
/Fdoes not have an option to include hidden directories and files - they are invariably excluded.[1]
Solutions:
This answer contains an custom PowerShell function named
treethat extends the functionality oftree.comand whose-Forceswitch allows you to include hidden items.The
Get-PSTreecmdlet from the third-partyPSTreemodule (install with, e.g.,Install-Module PSTree) also supports-Forceand offers even more features.[1] I'm referring to files and directories on Windows that have the
Hiddenattribute, which is unrelated to whether their names start with.(e.g.,.gitignore; it is only on Unix-like platforms that the latter are automatically considered hidden). You can set theHiddenattribute withattrib +H someDir, for instance, and clear it withattrib -H someDir.tree.comdoes not show such hidden items.