Skip to content

Instantly share code, notes, and snippets.

@dcabines
Created September 4, 2023 19:37
Show Gist options
  • Save dcabines/4423864fdb7f3ddbdcefc646b605e214 to your computer and use it in GitHub Desktop.
Save dcabines/4423864fdb7f3ddbdcefc646b605e214 to your computer and use it in GitHub Desktop.
compress all folders inside current folder
foreach($folder in Get-ChildItem) {
if(Test-Path -PathType Leaf -Path "$folder.zip") {
Write-Host "Skipping $folder"
continue
}
Write-Host -NoNewline "Compressing $folder..."
Compress-7Zip -Path "$pwd\$folder" -ArchiveFileName "$folder.zip"
Write-Host "done"
}
@dcabines
Copy link
Author

dcabines commented Sep 4, 2023

I used it to compress the picture folders in my phone's backup. I like to compress small files like pictures so I can deal with them as a set instead of transferring each image individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment