Compress and decompress file
Published on: 25th Nov 2019
Updated on: 16th Jan 2022
Explanation
To compress and decompress files in Powershell is quite straightforward.
#compress "test" folder
Compress-Archive -Path "D:\temp3\test" -DestinationPath "D:\temp3\myFirstZipFile.zip"
#decompress the file to the "testFolder" folder.
Expand-Archive -Path "D:\temp3\myFirstZipFile.zip" -DestinationPath "d:\temp3\testFolder"
Use case
- Backup the existing files before rolling out the updates.
- Automating daily, weekly or monthly backup on the selected directory.
Jump to #POWERSHELL blog
Author
Lau Hon Wan, software developer.