Summary: Learn how to use the new Compress-Archive cmdlet to compress selected files in Windows PowerShell 5.0.
How can I compress a bunch of files on my computer that match a pattern I supply to Get-ChildItem?
Use Get-ChildItem to find the files you want to compress, and pipe the results to the Compress-Archive cmdlet,
for example (gci is an alias for Get-ChildItem):
gci c:\fso\*.txt | Compress-Archive -DestinationPath c:\fso\myarchive.zip
0 comments