1

How can I exclude certain file types when using Powershell and the PSCX Write-Zip cmdlet?

Right now I'm using this:

Write-Zip -Path "C:\Program Files (x86)\Folder" -OutputPath
"C:\newDeploy\backup\Folder.zip" -IncludeEmptyDirectories -NoClobber -Level 1

I need it to include the directory structure in the ZIP and I also need to exclude certain file types (eg: .txt).

Thank you for your help :)

-Jim

user1161625
  • 642
  • 1
  • 8
  • 13

1 Answers1

0

The closest I can come in this:

cd "C:\Program Files (x86)\Folder"
Get-ChildItem . -r -Exclude *.txt | Write-Zip -OutputPath c:\temp\folder.zip -IncludeEmptyDirectories -NoClobber -Level 1

but this doesn't seem to be honoring the request to include empty dirs.

Keith Hill
  • 194,368
  • 42
  • 353
  • 369
  • Thanks! I'll just take out that IncludeEmptyDirectories - if they are empty I probably don't need them anyway :) – user1161625 Feb 13 '12 at 14:53