-
01/19/2025
-
Big code refactoring, this update improves readability and simplicity.
-
Updates to
-Include
and-Exclude
parameters, with this update the patterns are evaluated using the object's.Name
property instead of.FullName
. -
In addition to the above, this update improves how the cmdlet displays trees when
-Include
is used. Before, the cmdlet would display sub-trees where no file was matched by the include patterns. Now, only trees having files matched by the patterns are displayed.# PSTree v2.2.0 PS ..\pwsh> Get-PSTree ..\PSTree -Include *.ps1, *.cs -Exclude *tools, *output Source: C:\User\PSTree Mode Length Hierarchy ---- ------ --------- d---- 29.57 KB PSTree -a--- 1.34 KB ├── build.ps1 d---- 0.00 B ├── .github d---- 4.10 KB │ └── workflows d---- 4.11 KB ├── .vscode d---- 229.32 KB ├── assets d---- 0.00 B ├── docs d---- 12.55 KB │ └── en-US d---- 13.63 KB ├── module d---- 0.00 B ├── src d---- 11.50 KB │ └── PSTree -a--- 1.06 KB │ ├── Cache.cs -a--- 2.65 KB │ ├── CommandWithPathBase.cs -a--- 2.98 KB │ ├── PSTreeDirectory.cs -a--- 1.42 KB │ ├── PSTreeFile.cs -a--- 1.69 KB │ ├── PSTreeFileSystemInfo_T.cs -a--- 524.00 B │ ├── PSTreeFileSystemInfo.cs -a--- 404.00 B │ ├── TreeComparer.cs d---- 0.00 B │ ├── bin d---- 6.54 KB │ ├── Commands d---- 3.63 KB │ ├── Extensions d---- 1.14 KB │ ├── Internal d---- 16.83 KB │ ├── obj d---- 9.28 KB │ └── Style d---- 17.87 KB └── tests -a--- 765.00 B ├── FormattingInternals.tests.ps1 -a--- 6.15 KB ├── GetPSTreeCommand.tests.ps1 -a--- 1.77 KB ├── PSTreeDirectory.tests.ps1 -a--- 920.00 B ├── PSTreeFile.tests.ps1 -a--- 2.63 KB ├── PSTreeFileSystemInfo_T.tests.ps1 -a--- 4.90 KB └── TreeStyle.tests.ps1 # PSTree v2.2.1 PS ..\pwsh> Get-PSTree ..\PSTree -Include *.ps1, *.cs -Exclude tools, output Source: C:\User\PSTree Mode Length Hierarchy ---- ------ --------- d---- 1.34 KB PSTree -a--- 1.34 KB ├── build.ps1 d---- 0.00 B ├── src d---- 10.70 KB │ └── PSTree -a--- 1.06 KB │ ├── Cache.cs -a--- 2.65 KB │ ├── CommandWithPathBase.cs -a--- 2.98 KB │ ├── PSTreeDirectory.cs -a--- 1.42 KB │ ├── PSTreeFile.cs -a--- 1.69 KB │ ├── PSTreeFileSystemInfo_T.cs -a--- 524.00 B │ ├── PSTreeFileSystemInfo.cs -a--- 404.00 B │ └── TreeComparer.cs d---- 17.10 KB └── tests -a--- 765.00 B ├── FormattingInternals.tests.ps1 -a--- 6.15 KB ├── GetPSTreeCommand.tests.ps1 -a--- 1.77 KB ├── PSTreeDirectory.tests.ps1 -a--- 920.00 B ├── PSTreeFile.tests.ps1 -a--- 2.63 KB ├── PSTreeFileSystemInfo_T.tests.ps1 -a--- 4.90 KB └── TreeStyle.tests.ps1
-
-
09/12/2024
- Added
TreeStyle
type andGet-PSTreeStyle
cmdlet for rendering output. - Added Pester tests for
TreeStyle
. - Documented changes.
- Added
-
09/03/2024
-
Makes
Depth
property public forPSTreeFileSystemInfo
instances. -
Makes
GetParents()
method private, absolutely no reason to have it public. -
Added properties
ItemCount
andTotalItemCount
toPSTreeDirectory
instances, requested in Issue #34.PS ..\PSTree> pstree -Recurse -Force -Directory | Select-Object Hierarchy, Depth, ItemCount, TotalItemCount -First 15 Hierarchy Depth ItemCount TotalItemCount --------- ----- --------- -------------- PSTree 0 15 1476 ├── .git 1 13 1078 │ ├── hooks 2 13 13 │ ├── info 2 1 1 │ ├── logs 2 2 24 │ │ └── refs 3 2 22 │ │ ├── heads 4 9 9 │ │ └── remotes 4 1 11 │ │ └── origin 5 10 10 │ ├── objects 2 244 995 │ │ ├── 00 3 3 3 │ │ ├── 01 3 2 2 │ │ ├── 02 3 3 3 │ │ ├── 03 3 4 4 │ │ ├── 04 3 2 2 PS ..\PSTree> (Get-ChildItem -Force).Count 15 PS ..\PSTree> (Get-ChildItem -Force -Recurse).Count 1476 PS ..\PSTree> (Get-ChildItem .git -Force).Count 13 PS ..\PSTree> (Get-ChildItem .git -Force -Recurse).Count 1078 PS ..\PSTree>
-
-
08/29/2024
- Added method
.GetUnderlyingObject()
. Outputs the underlyingFileSystemInfo
instance. - Fixes Issue #9: Sort by ascending values:
-
PSTree v2.1.16
PS ..\PSTree> pstree -Directory -Depth 2 Source: D:\...\PSTree Mode Length Hierarchy ---- ------ --------- d---- 25.27 KB PSTree d---- 3.72 KB ├── tools d---- 16.96 KB │ ├── ProjectBuilder d---- 0.00 B │ └── Modules d---- 13.66 KB ├── tests d---- 0.00 B ├── src d---- 13.26 KB │ └── PSTree d---- 168.69 KB ├── output d---- 92.50 KB │ ├── TestResults d---- 0.00 B │ └── PSTree d---- 6.26 KB ├── module d---- 0.00 B ├── docs d---- 7.37 KB │ └── en-US d---- 4.11 KB ├── .vscode d---- 0.00 B └── .github d---- 4.10 KB └── workflows
-
PSTree v2.1.17
PS ..\PSTree> pstree -Directory -Depth 2 Source: D:\Zen\Documents\Scripts\PSTree Mode Length Hierarchy ---- ------ --------- d---- 25.27 KB PSTree d---- 0.00 B ├── .github d---- 4.10 KB │ └── workflows d---- 4.11 KB ├── .vscode d---- 0.00 B ├── docs d---- 7.37 KB │ └── en-US d---- 6.26 KB ├── module d---- 168.69 KB ├── output d---- 0.00 B │ ├── PSTree d---- 92.50 KB │ └── TestResults d---- 0.00 B ├── src d---- 13.26 KB │ └── PSTree d---- 13.66 KB ├── tests d---- 3.72 KB └── tools d---- 0.00 B ├── Modules d---- 16.96 KB └── ProjectBuilder
-
- Added method
-
02/26/2024
-
Added method
.GetFormattedLength()
. Outputs the friendly.Length
representation ofPSTreeFile
andPSTreeDirectory
instances.PS ..\PSTree> (Get-PSTree D:\ -RecursiveSize -Depth 0).GetFormattedLength() 629.59 GB
-
-
10/05/2023
- Added Parameter
-Include
. Works very similar to-Exclude
, the patterns are evaluated against the items.FullName
property, however this parameter targets only files (FileInfo
instances).
- Added Parameter
-
09/11/2023
- No changes to the cmdlet but a few improvements to the code base:
- #16
PSTreeCache
andPSTreeIndexer
internal classes have been sealed following the recommendations from dotnet/runtime#49944. - #17
Indent
extension method has been changed to useStringBuilder
. - #19 Improved
ConvertToTree
method. Was too complicated and inefficient, there was also no need to useRegex
. - #20
-Depth
parameter type was changed fromint
touint
and the documentation was updated accordingly.
- #16
- No changes to the cmdlet but a few improvements to the code base:
-
07/28/2023
-
Added
.ToString()
method toPSTreeFileSystemInfo<T>
instances, the method resolves to the instances.FullName
property similar toFileSystemInfo.ToString
Method. Now it should be possible to pipeGet-PSTree
output toGet-Item
andGet-ChildItem
when needed:Get-PStree -Depth 0 | Get-Item
-
Added
.Refresh()
method toPSTreeFileSystemInfo<T>
, functionality is the same asFileSystemInfo.Refresh
Method. -
Reorganizing source files and Pester tests.
-
Added more Pester tests.
-
Fixed a few documentation typos.
-
-
07/03/2023
-
Added
-Path
parameter, now both-Path
and-LiteralPath
parameters takestring[]
as input and support pipeline input. -
Added Pester tests, Code Coverage and coverage upload to codecov.io.
-
Removed
.Size
Property fromPSTreeFile
andPSTreeDirectory
instances. TheSize
column has been renamed toLength
and moved to the left-hand side of theHierarchy
column (I know it looks much better on the right-hand side 😑 but having it in the left allows for fixed width in the first 2 columns, which in turn brings less formatting issues 🤷♂️...).The default display for this column is available through
[PSTree.Internal._Format]::GetFormattedLength(...)
, for example:Get-PSTree | Select-Object Hierarchy, @{ N='Size'; E={ [PSTree.Internal._Format]::GetFormattedLength($_.Length) }}
-
Added
GroupBy
tag to the default view, now trees are grouped by the source Path omg! Little example:PS ..\PSTree> Get-PSTree .\src\, .\module\ -Exclude *\obj,*\bin Source: C:\path\to\PSTree\src Mode Length Hierarchy ---- ------ --------- d---- 0.00 B src d---- 10.30 KB └── PSTree -a--- 931.00 B ├── ExceptionHelpers.cs -a--- 439.00 B ├── PSTree.csproj -a--- 1.06 KB ├── PSTreeDirectory.cs -a--- 4.01 KB ├── PSTreeExtensions.cs -a--- 517.00 B ├── PSTreeFile.cs -a--- 399.00 B ├── PSTreeFileSystemInfo.cs -a--- 1.51 KB ├── PSTreeFileSystemInfo_T.cs -a--- 897.00 B ├── PSTreeHelper.cs -a--- 619.00 B ├── PSTreeIndexer.cs d---- 1.13 KB ├── Internal -a--- 1.13 KB │ └── _Format.cs d---- 5.68 KB └── Commands -a--- 5.68 KB └── GetPSTreeCommand.cs Source: C:\path\to\PSTree Mode Length Hierarchy ---- ------ --------- d---- 6.22 KB module -a--- 1.54 KB ├── PSTree.Format.ps1xml -a--- 4.67 KB └── PSTree.psd1
-
-
03/22/2023
Get-PSTree
is now a binary cmdlet. Functionality remains the same. Big thanks to SeeminglyScience and jborean93 for all their help!- Added
-Exclude
parameter to the cmdlet. The parameter accepts wildcards and patterns are matched with the object's.FullName
property. For more details checkout cmdlet docs.
-
02/25/2023
- Fixed a bug that made
Get-PSTree
use-Recurse
by default. - Added ETS properties to
PSTreeDirectory
andPSTreeFile
instances that would make exporting the output easier.
- Fixed a bug that made
-
10/23/2022
- PSTree Module is now published to the PowerShell Gallery!
- Introducing
-RecursiveSize
switch parameter toGet-PSTree
. By default,Get-PSTree
only displays the size of folders based on the sum of the files length in each Directory. This parameter allows to calculate the recursive size of folders in the hierarchy, similar to how explorer does it. It's important to note that this is a more expensive operation, in order to calculate the recursive size, all folders in the hierarchy need to be traversed.
PS ..\PSTree> pstree -Directory -Depth 2
Mode Hierarchy Size
---- --------- ----
d---- PSTree 9.51 Kb
d---- └── PSTree 4.83 Kb
d---- ├── public 4.8 Kb
d---- ├── private 0 Bytes
d---- └── Format 1.83 Kb
PS ..\PSTree> pstree -Directory -Depth 2 -RecursiveSize
Mode Hierarchy Size
---- --------- ----
d---- PSTree 180.38 Kb
d---- └── PSTree 14.75 Kb
d---- ├── public 4.8 Kb
d---- ├── private 3.29 Kb
d---- └── Format 1.83 Kb
- 06/19/2022
- Added format view for the Module -
PSTree.Format.ps1xml
. - The module now uses
EnumerateFileSystemInfos()
instance method. - Improved error handling (a lot).
-Files
parameter has been replaced with-Directory
parameter, now the module displays files by default.-Deep
parameter has been replaced with-Recurse
parameter, same functionality.PSTreeDirectory
andPSTreeFile
instances now only include 2 visible properties,Hierarchy
andLength
, the rest is done with format view.
- Added format view for the Module -
PS ..\PSTree> pstree -Recurse
Mode Hierarchy Size
---- --------- ----
d---- PSTree 10.21 Kb
-a--- ├── LICENSE 1.07 Kb
-a--- ├── README.md 9.15 Kb
d---- └── PSTree 4.83 Kb
-a--- ├── PSTree.psd1 4.57 Kb
-a--- ├── PSTree.psm1 270 Bytes
d---- ├── public 4.8 Kb
-a--- │ └── Get-PSTree.ps1 4.8 Kb
d---- ├── private 0 Bytes
d---- │ └── classes 3.29 Kb
-a--- │ └── classes.ps1 3.29 Kb
d---- └── Format 1.83 Kb
-a--- └── PSTree.Format.ps1xml 1.83 Kb
-
05/24/2022
- Lots of code improvements have been done to the Module and improved error handling. Now uses the
GetDirectories()
andGetFiles()
methods fromSystem.IO.DirectoryInfo
. EachPSTreeDirectory
instance now holds an instance ofDirectoryInfo
.System.Collections.Stack
has been changed forSystem.Collections.Generic.Stack<T>
.
- Lots of code improvements have been done to the Module and improved error handling. Now uses the
-
04/21/2022
- PSTree Module now uses
System.Collections.Stack
instead of recursion, performance should be much better now and functionality remains the same. Special thanks to IISResetMe.
- PSTree Module now uses
-
01/02/2022
- PSTree Module now has it's own classes, functionality remains the same however a lot has been improved.
- Recursion is now done using the static methods
[System.IO.Directory]::GetDirectories()
and[System.IO.Directory]::GetFiles()
instead ofGet-ChildItem
.
-
12/25/2021
-Files
switch has been added to the Module, now you can display files in the hierarchy tree if desired.Type
property has been added to the output object and is now part of the Default MemberSet.