Zip multiple files or folders but keep the file name

These two example files need to be compressed into one zip


20150113-Signs-R04.eps

20150113-Signs-R04.jpg


As you know the the default name of the zip becomes:


Archive.zip


I would like it to be:


20150113-Signs-R04.zip


I understand the ZIP utility cannot do this. However, I was hoping there is an Applescript that would help me get it done.

Mac Pro, Mac OS X (10.6.8), 30GB Ram 800 Mhz 2x2.8 Ghz Quad Int

Posted on Jan 20, 2015 10:57 AM

Reply
11 replies

Sep 6, 2015 3:51 PM in response to Eric Basir

Hi Eric,


I have the same problem and trying yo figure out a workflow that could do that. Actually, 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)


Did you manage to do that? Please help!

Sep 6, 2015 5:37 PM in response to JimEcon

JimEcon wrote:


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.)


This should do it (it also tests for the existence of the jpg, and will only zip if it exists, otherwise, it skips it):


User uploaded file


Run Shell Script Action is:


for f in "$@"

do

if [ ${f##*.} = "eps" ] ; then

if [ -f ${f%.*}.jpg ] ; then

zip --junk-paths ${f%.*} ${f%.*}.eps ${f%.*}.jpg

fi

fi

done

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Zip multiple files or folders but keep the file name

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.