Skip to content

Instantly share code, notes, and snippets.

@viveleroi
Created June 28, 2012 15:12
Show Gist options
  • Save viveleroi/3011918 to your computer and use it in GitHub Desktop.
Save viveleroi/3011918 to your computer and use it in GitHub Desktop.
ZipDroplet
on open (theItems) --receive items dropped onto droplet as a list
with timeout of 1000000 seconds
try
tell application "Finder"
--repeat the command to compress each item as an individual archive
repeat with oneItem in theItems
set itemProp to properties of oneItem
set itemPath to quoted form of POSIX path of oneItem
set fileName to name of oneItem
set theFolder to POSIX path of (container of oneItem as alias)
set zipFile to quoted form of (theFolder & fileName & ".zip")
set itemName to name of oneItem
do shell script ¬
("cd " & itemPath & "; cd ..; zip -r " & zipFile & " " & fileName & " -x '*.DS_Store'")
end repeat
end tell
on error errmsg
display dialog errmsg
end try
end timeout
end open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment