Align package.json scripts and their references across scripts/, infra/, and db/ SQL with the dev-first workflow naming scheme. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.0 KiB
PowerShell
43 lines
1.0 KiB
PowerShell
# Sync production image files from TrueNAS to dev repo.
|
|
#
|
|
# Usage:
|
|
# npm run prodto:dev:images
|
|
# .\infra\scripts\sync-images-from-prod.ps1
|
|
|
|
param(
|
|
[string]$Source = "\\192.168.10.122\Gallery\data\images",
|
|
[string]$Dest = (Join-Path $PSScriptRoot "..\..\data\images"),
|
|
[switch]$SkipConfirm
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
if (-not (Test-Path $Dest)) {
|
|
New-Item -ItemType Directory -Path $Dest -Force | Out-Null
|
|
}
|
|
$Dest = (Resolve-Path $Dest).Path
|
|
|
|
Write-Host "Source: $Source"
|
|
Write-Host "Dest: $Dest"
|
|
|
|
if (-not $SkipConfirm) {
|
|
$confirm = Read-Host "Copy all files from prod (skip older)? Type yes"
|
|
if ($confirm -ne "yes") {
|
|
Write-Host "Aborted."
|
|
exit 0
|
|
}
|
|
}
|
|
|
|
if (-not (Test-Path $Source)) {
|
|
Write-Error "Source not found: $Source"
|
|
exit 1
|
|
}
|
|
|
|
robocopy $Source $Dest /E /XO /R:2 /W:3 /NFL /NDL /NJH /NJS
|
|
$code = $LASTEXITCODE
|
|
if ($code -ge 8) {
|
|
Write-Error "robocopy failed with exit code $code"
|
|
exit $code
|
|
}
|
|
|
|
Write-Host "Image sync complete (robocopy exit $code)."
|