Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Unix&Linux>>Zip up a file from shell script

Zip up a file from shell script

iNemo
03-20-2006, 12:02 PM
I need to zip up a .app bundle automatically from a shell script, and was wondering how to do that.

After reading the zip man I still don't understand the syntax to zip up foo.app.

Could someone point me in the right direction please.

Caius.

mark hunte
03-20-2006, 01:10 PM
I had the same problem the other day.

zip -r zipname.zip bundled.app/

I had to cd to the folder the app was in.

the -r is a recursive option which you need for the bundle.
But if I do not cd to the folder and put the full path to the app.

Users/Usernam/Desktop/bundled.app

using the -r option gave me a zip with a folder hierarchy with Users/Usernam/Desktop/bundled.app

Hence cd to the containing folder first.

Others may tell us how to do it better.

iNemo
03-20-2006, 01:16 PM
Thanks!

A simple

cd foo/bar && zip -r foo.zip foo.app/ && cd ../../


should work for me!

mark hunte
03-20-2006, 01:22 PM
Are the && the same as ; but they wait for completion?

hayne
03-20-2006, 01:34 PM
Are the && the same as ; but they wait for completion?
See this: http://www.tldp.org/LDP/abs/html/list-cons.html#LISTCONSREF

hayne
03-20-2006, 01:37 PM
using the -r option gave me a zip with a folder hierarchy with Users/Usernam/Desktop/bundled.app

Hence cd to the containing folder first.

Others may tell us how to do it better.

I haven't tried it, but it looks like maybe the "-j" option will do what you want.
I.e. try:
zip -rj

mark hunte
03-20-2006, 01:45 PM
Thanks Hayne..

using the -rj does indeed get ride of the directories.

But in a application bundle app you need them. (imagine show package contents)

What the problem was it, with out cd-ing to the container of the app.
you got all the directories above it included (empty).

You had to drill down to find you application bundle.

jbc
03-20-2006, 08:46 PM
You can also do something like the following. In my tests, it seems to create a standard double-clickable OS X zip archive.ditto -c -k --sequesterRsrc --keepParent /Applications/MyApp.app/ /Applications/MyApp.zip


 

TOP

Windows Server Outsell
Unix Signals And C++ E

For more info

Unix Signals And C++ E
Windows Server Outsell
bash not using my .bas
Applescript: Hide Proc
help with installing p
Mozilla install from d
ssh - don't want to us
Escaping quotes in Tig
Terminal Keybindings 
JAVA help, please! 

News Archive

Displaying Images on t
Install Office from th
Terminal Problem...? 
cc1plus not executable
desktop icons.. 
at & growlnotify 
unknown terminal type 
scp arbitrary files 
What and why is a 'Dis
permissions already me

Related stories:

Applescript to quit Entourage?
Compare domain key of two Info.plist files
X11 Mode and Gnome Questions
Batch Modifying Modification Dates
mac image burning
DarwinPorts funkiness
cd to front Finder window

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics