Create, inspect, stage, and extract ZIP packages while retaining folder structure.
Sheet: 12 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026
Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.
Quick commands
1. Create a ZIP with the top-level library folder
Compress-Archive -LiteralPath 'C:\MGU-Staging\library' -DestinationPath 'C:\MGU-Staging\library.zip'
2. Archive folder contents without the outer folder
Compress-Archive -Path 'C:\MGU-Staging\library\*' -DestinationPath 'C:\MGU-Staging\contents.zip'
3. Inspect ZIP entry paths before extracting
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [IO.Compression.ZipFile]::OpenRead('C:\Downloads\package.zip')
try { $zip.Entries | Select-Object FullName, Length }
finally { $zip.Dispose() }
4. Extract to a fresh staging directory
$destination = 'C:\MGU-Staging\package-review'
if (Test-Path -LiteralPath $destination) { throw 'Choose a fresh staging folder.' }
Expand-Archive -LiteralPath 'C:\Downloads\package.zip' -DestinationPath $destination -ErrorAction Stop
5. Inspect staged HTML files
Get-ChildItem -LiteralPath 'C:\MGU-Staging\package-review' -Recurse -File -Filter '*.html' |
Select-Object FullName
6. Preview deployment of a reviewed library tree
Copy-Item -LiteralPath 'C:\MGU-Staging\package-review\library' -Destination 'C:\MGU' -Recurse -WhatIf
Operational notes
Inspect archive paths, expected root, and existing destination files before extraction or deployment. Avoid -Force for extraction unless overwrites are authorized. Compress-Archive skips hidden items and has documented per-file size limitations; use another suitable archive tool if these matter.