mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-23 18:38:19 +02:00
Improved check-symlinks.ps1
This commit is contained in:
parent
43eb1283db
commit
cf7b28a93f
@ -21,13 +21,13 @@ try {
|
|||||||
$path = $_.FullName + "\..\" + ($_ | Select-Object -ExpandProperty Target)
|
$path = $_.FullName + "\..\" + ($_ | Select-Object -ExpandProperty Target)
|
||||||
$item = Get-Item $path -ErrorAction Ignore
|
$item = Get-Item $path -ErrorAction Ignore
|
||||||
if (!$item) {
|
if (!$item) {
|
||||||
write-output "Symlink $Symlink -> $Target is broken"
|
write-warning "Broken symlink: $Symlink -> $Target"
|
||||||
$SymlinksBroken++
|
$SymlinksBroken++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$SymlinksTotal++
|
$SymlinksTotal++
|
||||||
}
|
}
|
||||||
echo "Done - found $SymlinksTotal symlinks total, $SymlinksBroken are broken"
|
write-output "Done - found $SymlinksTotal symlinks total, $SymlinksBroken are broken"
|
||||||
exit $SymlinksBroken
|
exit $SymlinksBroken
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user