This project is read-only.

Powershell Zip Files Export (Create, Add Files to Zip File) and Import (Extract Files form Zip File) Module

Cmdlets to create Zip files and extract files from Zip files.

Powershell Zip Documentation

Export-Zip Cmdlet

Exports the files in the pipeline or the file given in the command line into one or multiple zip files.
The Cmdlet gives you full control over the filenames and directory structure of the Zip file and allows pipelined operations

Creation Zip Files using command line parameters:
# Create Zip file and add MyFileToAdd.txt to it
Export-Zip  MyFileToAdd.txt 

# Append MyFileAdd2.txt to exiting Zip file
Export-Zip  MyFileToAdd2.txt -append

Creating Zip Files using the Pipeline
# Get-ChildItem places a complete subdirectory on the pipeline. These files are compressed and added to the Zip file D:\
# In this sample the subdirectory should be a subdirectory of D:\Work. The parent directory D:\Work is stripped and the files are placed in the directory DirInZipFile
Get-ChildItem -recurse | Select Name, DirectoryName, @{"Name"="ZipFile"; "Expression"={'D:\TEST.ZIP'}} | Export-Zip -EntryRoot D:\Work -EntryDir DirInZipFile

# For example the file D:\Work\Text\MyText.txt is placed in the Zip file as \DirInZipFile\Text\MyText.txt

Import-Zip Cmdlet

Imports files from one or multiple zip files.

Project URLs:

Last edited Mar 21, 2011 at 3:13 PM by ThomasMaierhofer, version 16