mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-22 20:51:17 +01:00
Improved the scripts
This commit is contained in:
parent
61b0c3e65d
commit
47459e0139
@ -28,7 +28,7 @@ try {
|
||||
}
|
||||
$SymlinksTotal++
|
||||
}
|
||||
write-output "Done - found $SymlinksTotal symlinks total, $SymlinksBroken are broken"
|
||||
write-host -foregroundColor green "Done - $SymlinksBroken out of $SymlinksTotal are broken"
|
||||
exit $SymlinksBroken
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -12,9 +12,13 @@ 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."
|
||||
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 {
|
||||
write-output $_.FullName
|
||||
$Count++
|
||||
}
|
||||
write-host -foregroundColor green "Done - found $Count empty directories"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -13,8 +13,12 @@ try {
|
||||
$DirTree = read-host "Enter the path to the directory tree"
|
||||
}
|
||||
write-progress "Listing empty files in $DirTree ..."
|
||||
Get-ChildItem $DirTree -recurse | Where {$_.PSIsContainer -eq $false} | Where {$_.Length -eq 0} | select FullName
|
||||
echo "Done."
|
||||
[int]$Count = 0
|
||||
Get-ChildItem $DirTree -recurse | Where {$_.PSIsContainer -eq $false} | Where {$_.Length -eq 0} | ForEach-Object {
|
||||
write-output $_.FullName
|
||||
$Count++
|
||||
}
|
||||
write-host -foregroundColor green "Done - found $Count empty files"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user