#PSTip Compress files and folders with System.IO.Compression.FileSystem class
Using the CreateFromDirectory and ExtractToDirectory methods, it is possible to compress and extract files. In this tip I will show different constructors that can be used to either compress or extract files using this class. The following example will compress the files stored in the c:\testing folder:
|
|
When you want to extract files, use the ExtractToDirectory method:
|
|
In PowerShell 5.0 the Compress-Archive and Expand-Archive cmdlets are available to simplify working with compressed archives.
For more information about the ZipFile class and the Compress-Archive and Expand-Archive cmdlets please refer to the following articles:
Share on: