Functions/Get-7Zip.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<#
.SYNOPSIS
List contents of a compressed archive file
.DESCRIPTION
Use Get-7Zip to list the contents of an archive.
.EXAMPLE
Get-7Zip archive.zip

List contents of archive.zip in the current working folder

.EXAMPLE
Get-7Zip "c:\folder\files.gz"

List contents of c:\folder\files.gz

.PARAMETER FullName
The full path of the compressed archive file.
.LINK
http://gavineke.com/PS7Zip/Get-7Zip
#>

Function Get-7Zip {
    [CmdletBinding(HelpUri='http://gavineke.com/PS7Zip/Get-7Zip')]
    Param(
        [Parameter(Mandatory=$True,Position=0,ValueFromPipelineByPropertyName=$True)]
        [ValidateScript({$_ | Test-Path -PathType Leaf})]
        [System.IO.FileInfo]$FullName
    )
    
    Begin {}
    
    Process {
        Write-Verbose -Message 'Getting contents of archive file'
        & "$7zaBinary" l "$FullName"
    }
    
    End {}
    
}