Today I needed to compress numerous (around 25) directories into individual archives (in this case, zip’s) and then rename them with a different extension (in this case ‘cbz’). This would have been extremely painful to do manually… I mean, right click a directory — one at a time — then left click “compress” (or zip, depending on the context menu)… and I’m not even going to go into renaming (there are at least 3 ways to manually rename a file, and I don’t want to describe them now. If you care to know just ask).
So what did I do? Did I really bother with all of that nonsense?! NO WAY! I have no patience for that!
Here’s the easy way:
1.) First, open your terminal (sorry, this is for Mac and Linux machines only, I don’t have time to convert the code to work on Windows).
2.) Next, navigate to the directory your files are in.
3.) Finally, run this command:
And it’s as simple as that! All done in one easy process, just a few lines of code!
If you just want to do a batch zip, without the rename, use this code instead:
I hope that helps someone out there…
Here are a few different methods to try for batch-zipping in Linux: