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

View File

@ -10,7 +10,8 @@ The following PowerShell scripts can be found in the Scripts/ subfolder:
* [download.ps1](Scripts/download.ps1) - downloads the file/directory from the given URL * [download.ps1](Scripts/download.ps1) - downloads the file/directory from the given URL
* [empty-dir.ps1](Scripts/empty-dir.ps1) - empties the given directory * [empty-dir.ps1](Scripts/empty-dir.ps1) - empties the given directory
* [exe_info.ps1](Scripts/exe_info.ps1) - prints basic information of the given executable file * [exe_info.ps1](Scripts/exe_info.ps1) - prints basic information of the given executable file
* [list-unused-files.ps1](Scripts/list-unused-files.ps1) - lists unused files in a dir tree * [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders in a directory tree
* [list-unused-files.ps1](Scripts/list-unused-files.ps1) - lists unused files in a directory tree
* [lscmdlets.ps1](Scripts/lscmdlets.ps1) - lists all PowerShell cmdlets * [lscmdlets.ps1](Scripts/lscmdlets.ps1) - lists all PowerShell cmdlets
* [lsmods.ps1](Scripts/lsmods.ps1) - lists all PowerShell modules * [lsmods.ps1](Scripts/lsmods.ps1) - lists all PowerShell modules
* [lsproc.ps1](Scripts/lsproc.ps1) - lists the local computer processes * [lsproc.ps1](Scripts/lsproc.ps1) - lists the local computer processes

0
Scripts/empty-dir.ps1 Normal file → Executable file
View File

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

0
Scripts/list-unused-files.ps1 Normal file → Executable file
View File