85 lines
2.7 KiB
PowerShell
85 lines
2.7 KiB
PowerShell
# 项目迁移验证脚本
|
||
Write-Host "======================================"
|
||
Write-Host "项目迁移验证"
|
||
Write-Host "======================================"
|
||
Write-Host ""
|
||
|
||
# 统计文件数
|
||
Write-Host "1. 文件数量统计..."
|
||
$srcFiles = (Get-ChildItem -Path "c:/Users/Admin/WorkBuddy/20260310215221" -Recurse -File -ErrorAction SilentlyContinue | Measure-Object).Count
|
||
$dstFiles = (Get-ChildItem -Path "D:\project" -Recurse -File -ErrorAction SilentlyContinue | Measure-Object).Count
|
||
Write-Host " 源目录: $srcFiles 个文件"
|
||
Write-Host " 目标目录: $dstFiles 个文件"
|
||
if ($srcFiles -eq $dstFiles) {
|
||
Write-Host " [OK] 文件数量匹配" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " [WARNING] 文件数量不匹配" -ForegroundColor Yellow
|
||
}
|
||
Write-Host ""
|
||
|
||
# 计算大小
|
||
Write-Host "2. 文件大小统计..."
|
||
$srcSize = (Get-ChildItem -Path "c:/Users/Admin/WorkBuddy/20260310215221" -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1MB
|
||
$dstSize = (Get-ChildItem -Path "D:\project" -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum / 1MB
|
||
Write-Host " 源目录: $([math]::Round($srcSize, 2)) MB"
|
||
Write-Host " 目标目录: $([math]::Round($dstSize, 2)) MB"
|
||
if ([math]::Abs($srcSize - $dstSize) -lt 1) {
|
||
Write-Host " [OK] 文件大小匹配" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " [WARNING] 文件大小不匹配" -ForegroundColor Yellow
|
||
}
|
||
Write-Host ""
|
||
|
||
# 验证关键文件
|
||
Write-Host "3. 关键文件验证..."
|
||
$criticalFiles = @(
|
||
"go.mod",
|
||
"README.md",
|
||
"cmd\server\main.go",
|
||
"configs\config.yaml",
|
||
"docker-compose.yml"
|
||
)
|
||
|
||
foreach ($file in $criticalFiles) {
|
||
$path = "D:\project\$file"
|
||
if (Test-Path $path) {
|
||
Write-Host " [OK] $file" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " [ERROR] $file - 缺失!" -ForegroundColor Red
|
||
}
|
||
}
|
||
Write-Host ""
|
||
|
||
# 检查目录结构
|
||
Write-Host "4. 目录结构验证..."
|
||
$directories = @(
|
||
"cmd",
|
||
"internal",
|
||
"configs",
|
||
"docs",
|
||
"deployment",
|
||
"migrations"
|
||
)
|
||
|
||
foreach ($dir in $directories) {
|
||
$path = "D:\project\$dir"
|
||
if (Test-Path $path -PathType Container) {
|
||
Write-Host " [OK] $dir\" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " [WARNING] $dir\ - 缺失" -ForegroundColor Yellow
|
||
}
|
||
}
|
||
Write-Host ""
|
||
|
||
Write-Host "======================================"
|
||
Write-Host "验证完成"
|
||
Write-Host "======================================"
|
||
Write-Host ""
|
||
Write-Host "下一步操作:"
|
||
Write-Host "1. cd D:\project"
|
||
Write-Host "2. go mod verify"
|
||
Write-Host "3. go build ./cmd/server"
|
||
Write-Host ""
|
||
Write-Host "确认无误后,可以删除C盘旧文件:"
|
||
Write-Host "Remove-Item -Path 'c:/Users/Admin/WorkBuddy/20260310215221' -Recurse -Force"
|