diff --git a/Scripts/list-empty-dirs.ps1 b/Scripts/list-empty-dirs.ps1 index f6b136f8..7601af7d 100755 --- a/Scripts/list-empty-dirs.ps1 +++ b/Scripts/list-empty-dirs.ps1 @@ -15,11 +15,11 @@ if ($DirTree -eq "" ) { try { write-progress "Listing empty directories in $DirTree..." [int]$Count = 0 - Get-ChildItem $DirTree -recurse | Where {$_.PSIsContainer -eq $true} | Where {$_.GetFileSystemInfos().Count -eq 0} | ForEach-Object { + Get-ChildItem $DirTree -attributes Directory -recurse | Where {$_.GetFileSystemInfos().Count -eq 0} | ForEach-Object { write-output $_.FullName $Count++ } - write-host -foregroundColor green "Done - found $Count empty directories" + write-host -foregroundColor green "OK - found $Count empty directories" exit 0 } catch { write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/Scripts/list-empty-files.ps1 b/Scripts/list-empty-files.ps1 index 59560a08..cbd30de1 100755 --- a/Scripts/list-empty-files.ps1 +++ b/Scripts/list-empty-files.ps1 @@ -15,11 +15,11 @@ if ($DirTree -eq "" ) { try { [int]$Count = 0 write-progress "Listing empty files in $DirTree ..." - get-childItem $DirTree -recurse | where {$_.PSIsContainer -eq $false} | where {$_.Length -eq 0} | foreach-object { + get-childItem $DirTree -attributes !Directory -recurse | where {$_.Length -eq 0} | foreach-object { write-output $_.FullName $Count++ } - write-host -foregroundColor green "Done - found $Count empty files" + write-host -foregroundColor green "OK - found $Count empty file(s)" exit 0 } catch { write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"