MACSCRPT Archives

March 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Philip Aker <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Sat, 18 Mar 2006 07:20:39 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
On 2006-03-17, at 17:00:46, Nobumi Iyanaga wrote:

> Hello,
>
> I would like to compress files and folders using zip via  
> scripting.  I had a look at man zip, and I tried some commands but  
> I seem to not understand how it works.
>
> For folders, it seems possible to compress them using something like:
>
> zip -r /Users/me/Documents/myFolder /Users/me/Documents/myFolder
>
> but I don't understand how to make a zip file of a wanted name in a  
> wanted folder.
>
> And I would like to avoid including .DS_Store files in the archive.
>
> On the other hand, I am unable to make any zip file of files.  This  
> is perhaps normal, since zip's main purpose is to make archive of  
> several files -- but with OS X's Finder, in File menu, I can easily  
> create zip files of files.
>
> Could anyone of you point me to an easy tutorial of how to use zip  
> in "do shell script" format?

Nobumi-san,


Say you have a file on your desktop called "file.txt". Then the call is:

	cd ~/Desktop;zip file file.txt


or for a folder with some ".txt" files in it:

	cd ~/Desktop;zip xxx xxx/*.txt


or for just one file in that folder:

	cd ~/Desktop/xxx;zip ../y y.txt


If you don't do the 'cd' portion, then the full directory path of the  
file(s) is nested into the .zip output.



Philip Aker
philip_aker->mac.dot.com

ATOM RSS1 RSS2