Files
2nd/scratch/wiki_move_p1.ps1

46 lines
2.0 KiB
PowerShell

$files = @(
@{src='00_Raw\WARNO.md'; dst='10_Wiki\Topics\AI & Games\WARNO.md'; cat='AI & Games'},
@{src='00_Raw\WARNO-DATA Wiki.md'; dst='10_Wiki\Topics\AI & Games\WARNO-DATA Wiki.md'; cat='AI & Games'},
@{src='00_Raw\WARNO-DATA 프로젝트.md'; dst='10_Wiki\Topics\AI & Games\WARNO-DATA 프로젝트.md'; cat='AI & Games'},
@{src='00_Raw\Steel Division 시리즈.md'; dst='10_Wiki\Topics\AI & Games\Steel Division 시리즈.md'; cat='AI & Games'},
@{src='00_Raw\Wargame 시리즈.md'; dst='10_Wiki\Topics\AI & Games\Wargame 시리즈.md'; cat='AI & Games'},
@{src='00_Raw\Eugen Systems.md'; dst='10_Wiki\Topics\Game Design\Eugen Systems.md'; cat='Game Design'},
@{src='00_Raw\ndf-parse.md'; dst='10_Wiki\Topics\Programming & Tools\ndf-parse.md'; cat='Programming & Tools'},
@{src='00_Raw\ndf-parse 패키지.md'; dst='10_Wiki\Topics\Programming & Tools\ndf-parse 패키지.md'; cat='Programming & Tools'}
)
foreach ($f in $files) {
$srcPath = Join-Path (Get-Location) $f.src
$dstPath = Join-Path (Get-Location) $f.dst
if (Test-Path $srcPath) {
$content = Get-Content $srcPath -Raw
# Title Cleanup: # [[Title]] -> # Title
$content = $content -replace '# \[\[(.*?)\]\]', '# $1'
# Add Frontmatter
$frontmatter = @"
---
category: $($f.cat)
status: Final
converted_at: 2026-04-28
---
"@
$newContent = $frontmatter + $content
# Ensure directory exists
$dir = [System.IO.Path]::GetDirectoryName($dstPath)
if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null }
# Write to destination
[System.IO.File]::WriteAllText($dstPath, $newContent, [System.Text.Encoding]::UTF8)
# Delete source (only after successful write)
if (Test-Path $dstPath) { Remove-Item $srcPath -Force; Write-Host "Processed and Moved: $($f.src)" }
} else {
Write-Host "Source not found: $($f.src)"
}
}