Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell 5 to Compress Files

$
0
0

Summary: Learn how to use the new Compress-Archive cmdlet to compress selected files in Windows PowerShell 5.0.

Hey, Scripting Guy! Question How can I compress a bunch of files on my computer that match a pattern I supply to Get-ChildItem?

Hey, Scripting Guy! Answer 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


Viewing all articles
Browse latest Browse all 3333

Trending Articles