1

Could someone help me with compressing thousands of files? I have a lot of folders and a lot of files in these folders, i would like to know if it's possible to compress each file separately. Foe example, folder 01 has folder 02 and 2 files in it, folder 02 has 2 files in it. I need to compress all files in all folders and leave these archives right where original files were.

Thank you!

multiple files in different folders

2 Answers 2

2

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.

1
  • Thanks for fixing the formatting, @Allan. Wasn't sure of the correct way to do it.
    – John Smith
    Jan 5, 2017 at 3:02
0

From memory, Stuffit Deluxe has this feature. There is an option to create individual archive files in the “Compression” preferences.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .