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

@ -28,7 +28,7 @@ list-automatic-variables.ps1, lists the automatic variables of PowerShell
list-current-timezone.ps1, lists the current time zone details
list-clipboard.ps1, lists the contents of the clipboard
list-environment-variables.ps1, lists all environment variables
list-empty-dirs.ps1, lists empty subfolders in a directory tree
list-empty-dirs.ps1, lists empty subfolders within the given directory tree
list-files.ps1, lists all files in the given folder and also in every subfolder
list-formatted.ps1, lists the current working directory formatted in columns
list-fritzbox-calls.ps1, lists the FRITZ!Box calls

1 Filename Description
28 list-current-timezone.ps1 lists the current time zone details
29 list-clipboard.ps1 lists the contents of the clipboard
30 list-environment-variables.ps1 lists all environment variables
31 list-empty-dirs.ps1 lists empty subfolders in a directory tree lists empty subfolders within the given directory tree
32 list-files.ps1 lists all files in the given folder and also in every subfolder
33 list-formatted.ps1 lists the current working directory formatted in columns
34 list-fritzbox-calls.ps1 lists the FRITZ!Box calls

View File

@ -34,7 +34,7 @@ Table of Contents
* [list-clipboard.ps1](Scripts/list-clipboard.ps1) - lists the contents of the clipboard
* [list-current-timezone.ps1](Scripts/list-current-timezone.ps1) - lists the current time zone details
* [list-environment-variables.ps1](Scripts/list-environment-variables.ps1) - lists all environment variables
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders in a directory tree
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree
* [list-installed-software.ps1](Scripts/list-installed-software.ps1) - lists the installed software
* [list-files.ps1](Scripts/list-files.ps1) - lists all files in the given folder and also in every subfolder
* [list-formatted.ps1](Scripts/list-formatted.ps1) - lists the current working directory formatted in columns

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."