Google Answers Logo
View Question
 
Q: Scripting applescript ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Scripting applescript
Category: Computers > Programming
Asked by: ghendo-ga
List Price: $20.00
Posted: 05 Jan 2006 22:14 PST
Expires: 04 Feb 2006 22:14 PST
Question ID: 429818
What applescript code can be used to create a zip archive
in a similar way that the finder create archive does.
Answer  
Subject: Re: Scripting applescript
Answered By: andyt-ga on 13 Jan 2006 21:11 PST
Rated:5 out of 5 stars
 
Hi Ghendo,

The following code will create a zip archive in a similar way to the
finder.  It uses applescript's 'do shell' command along with the
shell's 'zip'.  An example is below, you can replace the path to the
input file and the output zip archive with whatever you want to zip
and what you want the archive to be called.

do shell script "zip - /Users/andy/testfile.txt > /Users/andy/archive.zip"

Let me know if this answered your question, and if you require any
clarification, don't hesitate to ask.

Regards,
Andy

Request for Answer Clarification by ghendo-ga on 19 Jan 2006 00:32 PST
Didnt quite work
It vreated a filename.zip but when unzipped this file contain
a path to the real file the same as the path to the origianl file

ie it created a whole lot of subfolders

Clarification of Answer by andyt-ga on 12 Mar 2006 08:30 PST
Wow!! really sorry for the 3 month delay, Google answers apparently
doesn't notify me if a clarification is made after a rating, or maybe
I just forgot...  Anyway, have you figured this out yet?  I just tried
this by opening up script editor and pasting this in after creating a
testfile.txt.  It put the archive right where I wanted it.  However,
if you're having problems try modifying what's after the > .  Maybe
make it only the file name, etc.
ghendo-ga rated this answer:5 out of 5 stars

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy