Answer the question
In order to leave comments, you need to log in
How to sort an array of paths in PowerShell?
Good afternoon.
There is a PS script.
I get a list of all directories for the specified directory $path
$itemFolders = Get-ChildItem $Path
$AllFolders = $itemFolders | Get-ChildItem -Recurse | Where-Object {$_.PSIsContainer} | Select -Property FullName
FullName
--------
D:\SHARES\POSTBOX\IT\1
D:\SHARES\POSTBOX\IT\2
D:\SHARES\POSTBOX\IT\3
D:\SHARES\POSTBOX\IT\2\ 22
D:\SHARES\POSTBOX\IT\3\33
D:\SHARES\POSTBOX\IT\3\33\333
FullName
--------
D:\SHARES\POSTBOX\IT\3\33\333
D:\SHARES\POSTBOX\IT\3\33
D:\SHARES\POSTBOX\IT\3
D:\SHARES\ POSTBOX\IT\2\22
D:\SHARES\POSTBOX\IT\2
D:\SHARES\POSTBOX\IT\1
FullName
--------
D:\SHARES\POSTBOX\IT\3\33\333
D:\SHARES\POSTBOX\IT\3\33
D:\SHARES\POSTBOX\IT\2\22
D:\ SHARES\POSTBOX\IT\3
D:\SHARES\POSTBOX\IT\2
D:\SHARES\POSTBOX\IT\1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question