Zip folder contents using 7zip

Ever got annoyed with your disk filling up with big database backups, text files or other compressable data? 7ZIP to the rescue! Zip folder contents using 7zip!

With the following oneliner you backup all files in a seperate ZIP file and delete the files after:

dir *.[bak/txt/dmp] | ForEach-Object { & "C:\Program Files\7-Zip\7z.exe" a -tzip ($_.Name+".zip") $_.Name }

Easy peasy lemon squeezy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.