Skip to content

Instantly share code, notes, and snippets.

@seyDoggy
Created August 17, 2011 15:40
Show Gist options
  • Save seyDoggy/1151812 to your computer and use it in GitHub Desktop.
Save seyDoggy/1151812 to your computer and use it in GitHub Desktop.
Drives me nuts that Finder doesn't have a hotkey for file compression. You can use this script triggered with Quicksilver/FastScripts/LaunchBar/Butler/Alfred...
-- source: http://hints.macworld.com/article.php?story=2011030403522197
-- from comment Authored by: regulus on Mar 04, '11 09:13:11AM
try
tell application "Finder"
set theSelection to the selection
set selectionCount to count of theSelection
if selectionCount is greater than 1 then
error "Please select only one Finder item before running this script."
else if selectionCount is less than 1 then
error "Please select one Finder item before running this script."
else
set theItem to (item 1 of theSelection) as alias
set destFolder to (container of theItem) as alias
set itemName to name of theItem
end if
end tell
do shell script ("ditto -c -k --sequesterRsrc --keepParent " & quoted form of POSIX path of theItem & space & quoted form of (POSIX path of destFolder & itemName & ".zip"))
on error theError
tell me
activate
display dialog "Error: " & theError buttons {"OK"} default button 1 with icon stop
end tell
end try
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment