Updated list-empty-dirs.ps1

This commit is contained in:
Markus Fleschutz
2021-02-10 12:27:38 +01:00
parent 10e90ab3db
commit 4ea5d262bf
3 changed files with 8 additions and 5 deletions

View File

@ -1,14 +1,17 @@
#!/bin/powershell
<#
.SYNTAX ./list-empty-dirs.ps1 <dirtree>
.DESCRIPTION lists empty subfolders in the <directory tree>
.SYNTAX ./list-empty-dirs.ps1 [<dir-tree>]
.DESCRIPTION lists empty subfolders within the given directory tree
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
param([string]$DirTree)
param($DirTree = "")
try {
if ($DirTree -eq "" ) {
$DirTree = read-host "Enter the path to the directory tree"
}
write-progress "Listing empty subfolders in $DirTree ..."
(Get-ChildItem $DirTree -recurse | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | select FullName
echo "Done."