Skip to content

# milestone patch v3.0.1 - a4 #11

Description

@aj1126

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"
        }
    }

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions