Created
September 4, 2023 19:37
-
-
Save dcabines/4423864fdb7f3ddbdcefc646b605e214 to your computer and use it in GitHub Desktop.
compress all folders inside current folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.