Added list-empty-dirs.ps1

This commit is contained in:
Markus Fleschutz
2020-10-10 16:18:53 +00:00
parent c209ce3ab6
commit bebfafac22
4 changed files with 20 additions and 1 deletions

18
Scripts/list-empty-dirs.ps1 Executable file
View File

@ -0,0 +1,18 @@
#!/snap/bin/powershell
#
# Syntax: ./list-empty-dirs.ps1 <dirtree>
# Description: lists empty subfolders in the <directory tree>
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
param([string]$DirTree)
write-host "Listing empty subfolders in $DirTree ..."
try {
(gci $DirTree -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | select FullName
echo "Done."
exit 0
} catch { Write-Error $Error[0] }
exit 1