1

I have a folder that contains files with the same file name but different extensions (.jpg and .eps). Each .eps has a matching .jpg with the same name and I want to zip them together in pairs. (The zip file should have the same name.)

The naming convention is like this: 1.eps 1.jpg 2.eps 2.jpg ...etc.

I want to create something like this: 1.zip (containing 1.eps and 1.jpg) 2.zip (containing 2.eps and 2.jpg

I am using MAC OS X. I want to automate the process cause I have thousands of files.

I am currently doing it manually by selecting two files at a time compress them and then rename. So I need something to find the files with the same name automatically within a folder, zip them together in a single zip file, and use the same name for the zip.

closed as off-topic by heemayl, muru, Sergiy Kolodyazhnyy, Eric Carvalho, Pilot6 Sep 7 '15 at 10:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – heemayl, muru, Sergiy Kolodyazhnyy, Eric Carvalho, Pilot6
If this question can be reworded to fit the rules in the help center, please edit the question.

4

Assuming Bash, this may work for you:

for i in *.eps; do  zip "${i%.*}.zip" "${i%.*}".*; done
  • Thank you this worked fine! You saved me from a lot of pain! – JIM Sep 6 '15 at 23:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.