Created
June 28, 2012 15:12
-
-
Save viveleroi/3011918 to your computer and use it in GitHub Desktop.
ZipDroplet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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