Skip to content

Instantly share code, notes, and snippets.

@pudquick
Created March 3, 2018 20:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pudquick/470bcd976b104942c9cfd7234a9814fa to your computer and use it in GitHub Desktop.
Save pudquick/470bcd976b104942c9cfd7234a9814fa to your computer and use it in GitHub Desktop.
Make DMGs from folders
property destination_for_dmgs : "/Users/mike/Desktop"
on open the_items
repeat with an_item in the_items
set the_info to info for an_item
if kind of the_info is "Folder" then
set dmg_path to quoted form of (destination_for_dmgs & "/" & (name of the_info) & ".dmg")
set src_path to quoted form of POSIX path of an_item
set vol_name to quoted form of (name of the_info)
set command_str to "hdiutil create " & dmg_path & " -volname " & vol_name & " -srcfolder " & src_path
do shell script command_str
end if
end repeat
end open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment