1

I tried to zip files from a given folder excluding one folder doing it with one command.

It is based on How do I exclude a folder in compress-archive

I am trying

powershell Compress-Archive -Path "Get-ChildItem * -Exclude Sql -Name" -DestinationPath ..\..\Products\File4.zip

It throws

Compress-Archive : A positional parameter cannot be found that accepts argument '*'.

When I use command powershell Get-ChildItem * -Exclude Sql -Name it work.

It is possible to this it in this way?

phuclv
  • 37,963
  • 15
  • 156
  • 475
Silny ToJa
  • 1,815
  • 1
  • 6
  • 20

1 Answers1

2

use this syntax:

Compress-Archive -Path (Get-ChildItem * -Exclude Sql -Name) -DestinationPath .....
Frenchy
  • 16,386
  • 3
  • 16
  • 39