To do this, you can open up Terminal from inside your computer's /Applications/Utilities
folder. Then change to the root directory containing all the other directories you want to zip the files in by typing this command:
cd /path/to/folder01
(replace /path/to/folder01
with wherever the folder is on your hard drive - it will give you the right path if you simply drag the folder icon from your Finder, right into the Terminal window.)
then type this command:
find . -type f -execdir zip '{}.zip' '{}' \; -delete
This will compress all files (not directories) within the directory tree starting with the folder /folder01
, leaving the .zip
in the same directory as the original, and delete the originals.
If for some reason you don't want to delete the originals but rather leave them in place next to the .zip
archives, you can omit the -delete
at the end.
I would recommend backing up the entire directory tree you're running this on first before trying it, just in case you make a typo or anything goes wrong. This worked as described for me, but you mess around in Terminal on your computer at your own risk.