From 7d86cae5b156215de65f3f10a1451fdbbb070e2e Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 26 Aug 2025 15:55:21 -0600 Subject: [PATCH] wipe destination in _CURRENT --- UpdateSequences.bat | 1 + UpdateSequences.ps1 | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/UpdateSequences.bat b/UpdateSequences.bat index 61a8143..e58d238 100644 --- a/UpdateSequences.bat +++ b/UpdateSequences.bat @@ -8,4 +8,5 @@ set "rc=%errorlevel%" echo PowerShell exited with RC=%rc% echo @"_CURRENT\_UpdateSequences.log" echo Done. +pause >nul exit /b %rc% \ No newline at end of file diff --git a/UpdateSequences.ps1 b/UpdateSequences.ps1 index 4df8706..83c8fc2 100644 --- a/UpdateSequences.ps1 +++ b/UpdateSequences.ps1 @@ -174,6 +174,15 @@ try { $srcFull = $parts[1] $seqName = $parts[2] $dstAbs = Join-Path $currentDir $seqName + if (Test-Path -LiteralPath $dstAbs) { + "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] WIPE: removing existing destination '$dstAbs'" | Add-Content -LiteralPath $logFile + try { + Remove-Item -LiteralPath $dstAbs -Recurse -Force -ErrorAction Stop + } + catch { + "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] WIPE ERROR: $($_.Exception.Message)" | Add-Content -LiteralPath $logFile + } + } if (-not (Test-Path -LiteralPath $dstAbs)) { New-Item -ItemType Directory -Path $dstAbs -Force | Out-Null } "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] Mirror: '$srcFull' -> '$dstAbs'" | Add-Content -LiteralPath $logFile $robocopyArgs = @(