milestone patch v3.0.1 - a4
4. Recursive Archive Compression
File: src/MyBookTools.psm1
Function: Invoke-MyBookCleanup
Issue: Exponential file bloat during archive cleanup.
Root Cause: The script generates the new .zip file directly inside the Archives folder it is actively compressing, causing it to swallow the previous iterations of itself.
Resolution:
Target the $RootPath (outside the scope of the archive directory) for the output .zip.
if ($CompressArchives) {
$archiveRoot = Join-Path $RootPath 'Archives'
if (Test-Path $archiveRoot) {
# Target the root path, not the archive folder itself
$zipPath = Join-Path $RootPath ("Archives_{0:yyyyMMdd_HHmmss}.zip" -f (Get-Date))
Compress-Archive -Path (Join-Path $archiveRoot '*') -DestinationPath $zipPath -Force
Write-MyBookLog -Message "Compressed archives → $zipPath"
}
}
milestone patch v3.0.1 - a4
4. Recursive Archive Compression
File:
src/MyBookTools.psm1Function:
Invoke-MyBookCleanupIssue: Exponential file bloat during archive cleanup.
Root Cause: The script generates the new
.zipfile directly inside theArchivesfolder it is actively compressing, causing it to swallow the previous iterations of itself.Resolution:
Target the
$RootPath(outside the scope of the archive directory) for the output.zip.