external help file | Module Name | online version | schema |
---|---|---|---|
PSCompression.dll-Help.xml |
PSCompression |
2.0.0 |
Expands Zip Archive Entries to a destination directory.
Expand-ZipEntry
-InputObject <ZipEntryBase[]>
[-Destination <String>]
[-Force]
[-PassThru]
[<CommonParameters>]
The Expand-ZipEntry
cmdlet can expand zip entries outputted by the Get-ZipEntry
command to a destination directory. Expanded entries maintain their original folder structure based on their relative path.
PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Include *.txt | Expand-ZipEntry
PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Include *.txt | Expand-ZipEntry -Destination path\to\myfolder
PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Exclude *.txt | Expand-ZipEntry
Example 4: Extract all entries excluding .txt
files to the current directory overwritting existing files
PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Exclude *.txt | Expand-ZipEntry -Force
Demonstrates how -Force
switch works.
Example 5: Extract all entries excluding .txt
files to the current directory outputting the expanded entries
PS ..\pwsh> Get-ZipEntry path\to\myZip.zip -Exclude *.txt | Expand-ZipEntry -PassThru
By default this cmdlet produces no output. When -PassThru
is used, this cmdlet outputs the FileInfo
and DirectoryInfo
instances representing the expanded entries.
The destination directory where to extract the Zip Entries. This parameter is optional, when not used, the entries are extracted to the their relative zip path in the current directory.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: $PWD
Accept pipeline input: False
Accept wildcard characters: False
Existing files in the destination directory are overwritten when this switch is used.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The cmdlet outputs the FileInfo
and DirectoryInfo
instances representing the extracted entries when this switch is used.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The zip entries to expand.
Note
- This parameter takes input from pipeline, however binding by name is also possible.
- The input are instances inheriting from
ZipEntryBase
(ZipEntryFile
orZipEntryDirectory
) outputted byGet-ZipEntry
andNew-ZipEntry
cmdlets.
Type: ZipEntryBase[]
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
This cmdlet supports the common parameters. For more information, see about_CommonParameters.
You can pipe instances of ZipEntryFile
or ZipEntryDirectory
to this cmdlet. These instances are produced by Get-ZipEntry
and New-ZipEntry
cmdlets.
By default, this cmdlet produces no output.
The cmdlet outputs the FileInfo
and DirectoryInfo
instances of the extracted entries when -PassThru
switch is used.