File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,15 +169,26 @@ function Archive-PACS {
169169
170170 Write-Log " Archiving PACS files..." " INFO"
171171
172- $pacsDir = Join-Path $BaseInstallPath " data\storage\* "
172+ $storageDir = Join-Path $BaseInstallPath " data\storage"
173173 $archiveZip = Join-Path $BaseInstallPath " data\storage.zip"
174174
175+ if (-not (Test-Path $storageDir )) {
176+ Write-Log " PACS storage directory not found: $storageDir " " WARNING"
177+ return
178+ }
179+
180+ $pacsDir = Join-Path $storageDir " *"
181+ $hasFiles = Get-ChildItem - Path $pacsDir - Force - ErrorAction SilentlyContinue | Select-Object - First 1
182+ if (-not $hasFiles ) {
183+ Write-Log " No PACS files found to archive." " INFO"
184+ return
185+ }
186+
175187 Compress-Archive - Path $pacsDir - DestinationPath $archiveZip - Force
176188
177189 Write-Log " PACS files archived to $archiveZip ." " INFO"
178190
179191 Remove-Item $pacsDir - Recurse - Force
180-
181192 Write-Log " PACS files removed from storage directory." " INFO"
182193
183194 Write-Log " PACS files archived successfully." " SUCCESS"
You can’t perform that action at this time.
0 commit comments