Last active
July 9, 2016 20:46
-
-
Save ChristianBagley/4a14e8184475da498378 to your computer and use it in GitHub Desktop.
Applescript to eject all mounted volumes, except for those on exceptions list.
This file contains hidden or 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
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