Compressing as Individual Files in Folder
Let’s see how long it takes Jim Christopher to jump in with a better PowerShell solution. :)
I had a directory full of .avi files that contains RAW, uncompressed data at 60fps from a camera (for astroimaging). Even capturing just a few minutes of data amasses over 10GB of data:
No wonder my drive filled up so quickly. For archiving the data, I wanted to zip each file into its own file, not into a folder. Because I had about 50GB of videos to do, I wanted a simple cmd to do it for each folder. This is pretty easy to do with 7-Zip.
Bring up a command prompt in the folder you’d want each file to be individually zipped:
Assuming you have 7-Zip installed in its default location, use a command like:
for %I in ("*.avi") do "c:\Program Files\7-Zip\7z.exe" a "%I.zip" "%I" -mx=5 -mmt=4 –tzip
You’ll see the progress in the command prompt:
You can, of course, tweak that as necessary. This compresses each file nicely, now consuming about 1.6GB.
This is a handy way to zip up large number of files into individual archives!