Compress-Archive PowerShell Version 5

This one is one of the coolest newest cmdlets available in PowerShell V5 because engineers do not have to maintain 3rd party software like 7zip. This can be useful in situations if you get a lot files via ftp or logs files that can be archive at the end of the day or the end of the job. You can also pass as parameter what kind of compression you want to get. The following values are available for this

  • FastestUse – This will pretty much would archive the files together with next to none compression. This options is useful when you have have bunch of small files.
  • NoCompression – Like the name indicates it will not compress the files at all
  • Optimal – It will try to compress as much as as it can and it is the default value

Now let me give you some examples on how long it takes and the level of compression

  1. 10 text files  approx 10KB size file
    1. FastestUSE  – Time around 42 milliseconds  -Compression to 10KB
    2. NoCompression – Time around 53 milliseconds   -Compression None
    3. Optimal -Time around 60 milliseconds -Compression to  9KB

  2. 10 text Files  approx 10MB file
    1. FastestUSE  – Time around 1.8 seconds  -Compression to 2069KB
    2. NoCompression – Time around 2 seconds   -Compression none
    3. Optimal -Time around 2.3 milliseconds -Compression to  750KB

  3. 10 text Files approx 100MB each file
    1. FastestUSE  – Time around 16 seconds  -Compression to 22,730 KB
    2. NoCompression – Time around 20 seconds  -Compression none
    3. Optimal -Time around 24 seconds -Compression to  7,731KB

The script to test the different archive parameters is pretty simple and you can find it by clicking here

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s