mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-07 07:51:54 +02:00
Update check-symlinks.ps1
This commit is contained in:
parent
a4a09819a0
commit
f989a99a92
@ -4,7 +4,8 @@
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Checks every symlink in a directory tree.
|
Checks every symlink in a directory tree.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-symlinks C:\MyApp
|
PS> ./check-symlinks .
|
||||||
|
✔️ 0 out of 10 symlinks are broken in 📂/home/markus
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -26,7 +27,7 @@ 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-warning "Broken symlink: $Symlink -> $Target"
|
write-warning "Broken symlink $Symlink -> $Target"
|
||||||
$NumBroken++
|
$NumBroken++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user