Skip to content

Instantly share code, notes, and snippets.

@Meatballs1
Created April 21, 2016 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meatballs1/6490ce3833936eb185f34da4629dc854 to your computer and use it in GitHub Desktop.
Save Meatballs1/6490ce3833936eb185f34da4629dc854 to your computer and use it in GitHub Desktop.
Simple Powershell Compression
$path = "C:\data\sysvol_results.csv"
$inStream = new-object System.IO.FileStream($path, [System.IO.FileMode]::Open);
$outStream = new-object System.IO.FileStream("$($path).gz", [System.IO.FileMode]::CreateNew);
$compressionStream = new-object System.IO.Compression.GZipStream($outStream, [System.IO.Compression.CompressionMode]::Compress);
$inStream.CopyTo($compressionStream);
$inStream.Close();
$compressionStream.Close();
$outStream.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment