28 lines
1.0 KiB
PowerShell
28 lines
1.0 KiB
PowerShell
# Pfad zum docs-Ordner anpassen
|
|
$root = "C:\Users\isa.LTW\Desktop\24.06.2025\NodeMap\24.06.2025 NodeMap\docs"
|
|
|
|
# Alle .md-Dateien rekursiv holen, außer README.md
|
|
$mdFiles = Get-ChildItem -Path $root -Recurse -Filter *.md | Where-Object { $_.Name -ne "README.md" }
|
|
|
|
foreach ($file in $mdFiles) {
|
|
$content = Get-Content $file.FullName -Raw
|
|
|
|
if ($content -notmatch "\[Zurück zur Übersicht\]") {
|
|
# Pfad relativ zum Root-Ordner
|
|
$relativePath = $file.DirectoryName.Substring($root.Length).TrimStart('\')
|
|
$depth = if ($relativePath) { $relativePath.Split('\').Count } else { 0 }
|
|
|
|
# Rücksprungpfad berechnen
|
|
$backPath = ("../" * $depth) + "README.md"
|
|
|
|
# Footer-Text (ohne Emojis!)
|
|
$footer = "`n---`n`n[Zurück zur Übersicht]($backPath)`n`n"
|
|
|
|
# Footer anhängen
|
|
Add-Content -Path $file.FullName -Value $footer
|
|
Write-Host "✅ Footer hinzugefügt: $($file.FullName)"
|
|
} else {
|
|
Write-Host "🔄 Footer bereits vorhanden: $($file.FullName)"
|
|
}
|
|
}
|