kbdb #1

Open
opened 2026-07-30 08:40:17 +02:00 by groot · 3 comments
Owner
No description provided.
Author
Owner

Geänderte Source auf "vendor-docs", "vendor-docs-ms", "vendor-docs-linux" und "vendor-docs-sec"

Geänderte Source auf "vendor-docs", "vendor-docs-ms", "vendor-docs-linux" und "vendor-docs-sec"
Author
Owner
$utf8 = New-Object System.Text.UTF8Encoding($false)

Get-ChildItem "P:\KS-Sources\main\knowledge" `
    -Filter *.json -File -Recurse |
ForEach-Object {
    try {
        $path = $_.FullName

        # Explizit als UTF-8 lesen
        $text = [System.IO.File]::ReadAllText($path, $utf8)
        $json = $text | ConvertFrom-Json

        # auto_reply als Boolean setzen bzw. hinzufügen
        if ($null -eq $json.PSObject.Properties["auto_reply"]) {
            $json | Add-Member `
                -NotePropertyName auto_reply `
                -NotePropertyValue $false
        }
        else {
            $json.auto_reply = $false
        }

        # JSON erzeugen
        $output = $json | ConvertTo-Json -Depth 20

        # Explizit UTF-8 ohne BOM schreiben
        [System.IO.File]::WriteAllText($path, $output, $utf8)

        Write-Host "Geändert: $path"
    }
    catch {
        Write-Warning "Fehler bei $($_.FullName): $($_.Exception.Message)"
    }
}
``` $utf8 = New-Object System.Text.UTF8Encoding($false) Get-ChildItem "P:\KS-Sources\main\knowledge" ` -Filter *.json -File -Recurse | ForEach-Object { try { $path = $_.FullName # Explizit als UTF-8 lesen $text = [System.IO.File]::ReadAllText($path, $utf8) $json = $text | ConvertFrom-Json # auto_reply als Boolean setzen bzw. hinzufügen if ($null -eq $json.PSObject.Properties["auto_reply"]) { $json | Add-Member ` -NotePropertyName auto_reply ` -NotePropertyValue $false } else { $json.auto_reply = $false } # JSON erzeugen $output = $json | ConvertTo-Json -Depth 20 # Explizit UTF-8 ohne BOM schreiben [System.IO.File]::WriteAllText($path, $output, $utf8) Write-Host "Geändert: $path" } catch { Write-Warning "Fehler bei $($_.FullName): $($_.Exception.Message)" } } ```
Author
Owner
$utf8 = New-Object System.Text.UTF8Encoding($false)

Get-ChildItem "P:\KS-Sources\main\knowledge" -Filter *.json -File -Recurse |
ForEach-Object {
    try {
        $path = $_.FullName

        # Explizit als UTF-8 lesen
        $text = [System.IO.File]::ReadAllText($path, $utf8)
        $json = $text | ConvertFrom-Json

        # Source setzen bzw. hinzufügen
        if ($null -eq $json.PSObject.Properties["source"]) {
            $json | Add-Member -NotePropertyName source -NotePropertyValue "vendor-docs-sec"
        }
        else {
            $json.source = "vendor-docs-sec"
        }

        # JSON erzeugen
        $output = $json | ConvertTo-Json -Depth 20

        # Explizit UTF-8 OHNE BOM schreiben
        [System.IO.File]::WriteAllText($path, $output, $utf8)

        Write-Host "Geändert: $path"
    }
    catch {
        Write-Warning "Fehler bei $($_.FullName): $($_.Exception.Message)"
    }
}
``` $utf8 = New-Object System.Text.UTF8Encoding($false) Get-ChildItem "P:\KS-Sources\main\knowledge" -Filter *.json -File -Recurse | ForEach-Object { try { $path = $_.FullName # Explizit als UTF-8 lesen $text = [System.IO.File]::ReadAllText($path, $utf8) $json = $text | ConvertFrom-Json # Source setzen bzw. hinzufügen if ($null -eq $json.PSObject.Properties["source"]) { $json | Add-Member -NotePropertyName source -NotePropertyValue "vendor-docs-sec" } else { $json.source = "vendor-docs-sec" } # JSON erzeugen $output = $json | ConvertTo-Json -Depth 20 # Explizit UTF-8 OHNE BOM schreiben [System.IO.File]::WriteAllText($path, $output, $utf8) Write-Host "Geändert: $path" } catch { Write-Warning "Fehler bei $($_.FullName): $($_.Exception.Message)" } } ```
Sign in to join this conversation.