Skip to content

Instantly share code, notes, and snippets.

@ChristianBagley
Last active July 9, 2016 20:46
Show Gist options
  • Save ChristianBagley/4a14e8184475da498378 to your computer and use it in GitHub Desktop.
Save ChristianBagley/4a14e8184475da498378 to your computer and use it in GitHub Desktop.
Applescript to eject all mounted volumes, except for those on exceptions list.
set exceptionsList to {"JETDRIVE"}
tell application "Finder"
set diskList to the disks
repeat with mountedDisk in diskList
if name of mountedDisk is not in exceptionsList then
eject mountedDisk
end if
end repeat
end tellset exceptionsList to {"MobileBackups", "startup disk", "home", "net"}
tell application "Finder"
set diskList to the disks
repeat with mountedDisk in diskList
if name of mountedDisk is not in exceptionsList then
eject mountedDisk
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment