Skip to content

Instantly share code, notes, and snippets.

@BadgerCode
Created May 7, 2020 18:45
Show Gist options
  • Save BadgerCode/aa39266e61accaceb2a801d5d05e0565 to your computer and use it in GitHub Desktop.
Save BadgerCode/aa39266e61accaceb2a801d5d05e0565 to your computer and use it in GitHub Desktop.
Uses 7-zip CLI to compress files individually using BZIP2 on Windows
$path = "C:\Users\mike-\Downloads\stuff"
$7zipPath = "C:\Program Files\7-Zip\7z.exe"
$files = dir $path -Recurse -Include $mask | where {
($_.Length / 1KB) -gt 100
}
ForEach ($file in $files)
{
Write-Host "$($file.FullName).bz2"
& $7zipPath a -tbzip2 "$($file.FullName).bz2" $file.FullName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment