Zipping an application package by script
tsj at unimelb.edu.au
Tue Sep 9 23:50:55 CDT 2008
How bout this then...
tell application "Finder"
-- Note: There's no extensive error trapping on this script
-- (e.g. folder counts for larger folders to show warnings)
-- You could also take off any .xxx suffix before adding
-- the file to the .zip if needed
set theItem to selection as alias
set itemPath to quoted form of POSIX path of theItem
set fileName to name of theItem
set theFolder to POSIX path of (container of theItem as alias)
set zipFile to quoted form of (theFolder & fileName & ".zip")
do shell script "zip -r -j " & zipFile & " " & itemPath
-- delay 1 -- this may be needed (and adjusted) for larger folders?
try -- We don't need to say anything if there are no .DS_Store files
do shell script "zip -d " & zipFile & " '*.DS_Store'"
On 10/9/08 12:51 PM, "Richard Gaskin" <ambassador at fourthworld.com> wrote:
> Terry Judd wrote:
>> On 10/9/08 10:49 AM, "Stephen Barncard" wrote:
>>> I want to back up a REV .app package in MacOSX Leopard and send it to
>>> an FTP server. But I need to squash the whole thing for upload first.
>>> 1. I've been using the zip functions in Rev, but one has to handle
>>> each file separately and just keep track, or just turn the internal
>>> hierarchy into a flat folder. RevZip has no provision for maintaining
>>> folder structure. Does anyone know how to create (or where to
>>> include) a 'playlist' for a rev-zip file that can tell an unzipper to
>>> preserve the folders? How is that done?
> I think you're on your own there, Stephen. It's tedious to code, but
>>> 2. Using zip from the shell has problems - it doesn't want to see any
>>> .DS_Store nonsense, or for that fact anything else with duplicate
>>> names, even in different folders. I don't want to have to modify the
>>> content this way to make it work.
>>> 3. I have yet to find an Applescript that I could use that selects
>>> and engages the "Compress" item in the file menu of the finder, but
>>> if I could make that work that would be Marvey.
>> There's an Automator action for the Finder called 'create
>> archive' that should do what you want.
> Excited by the prospect of being able to create Zip archives without the
> dot files, I just tested it. No go: with the action's "Ignore
> unreadable files"option on or off (what exactly is an "unreadable
> files?"; the notes for that action do not explain) it still copies the
> .DS_Store files. :(
> Apple employs smart people. I'm sure one of them was smart enough to
> recognize that if they're somehow stuck with a file system requiring
> such kludges for simple metadata then surely there's a preference to
> govern it for copying and archiving. Now if only we could find it....
Dr Terry Judd
Lecturer in Educational Technology (Design)
Biomedical Multimedia Unit
Faculty of Medicine, Dentistry & Health Sciences
The University of Melbourne
Parkville VIC 3052
61-3 8344 0187
More information about the use-livecode