March 16th, 2014

PowerTip: Use PowerShell to Create Zip Archive

Doctor Scripto
Scripter

Summary: Learn how to use Windows PowerShell to easily create a zip archive.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create a zip archive of a folder on my system?

Hey, Scripting Guy! Answer Use Get-ChildItem from PSCX to copy the files, and pipe the output to the Write-Zip cmdlet:

Get-Childitem c:\fso -Recurse | Write-Zip -IncludeEmptyDirectories -OutputPath C:\fso_bu\fso.zip

Note: I have written several blog posts about the Windows PowerShell Community Extension Project.
For more information about obtaining the PSCX module, see these Hey, Scripting Guy! Blog posts.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback