Mount Hard Drive Script help needed
Mount Hard Drive Script help needed
Hi all,
I've had this older applescript for a while (that I got from the web somewhere)
- and it works great. It will toggle between mount or un-mounting all connected
drives. Very handy.
However - I just updated to Sierra (10.12.6) and now in addition to the main
Volumes it is also mounting all the EFI volumes also. This is something I do
not want.
Question: Is there a way to update the script so that it will NOT mount EFI
Volumes and just the Main volumes?
here is the full script............................
-- yo this will toggle both mount and unmount if you un or comment = --do shell
script "diskutil mountDisk or unmount lines
set alldisks to paragraphs of (do shell script "df -hlg | awk -F/ '/disk*/
{print $5}'")
set nonbootnumber to (count of alldisks)
try
set all_non_boot_disks to items 2 thru nonbootnumber of alldisks
on error
set all_non_boot_disks to {}
end try
if (count of all_non_boot_disks) > 0 then
try
activate
repeat with the_Item in all_non_boot_disks
set the_ID to (do shell script "df -hlg | grep -m 1" &
space & quoted form of the_Item & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
try
do shell script "diskutil unmount /dev/" &
the_ID
on error the error_message number the error_number
display dialog "Error: " & the error_number &
". " & the error_message buttons {"OK"} default button 1
end try
end repeat
on error the error_message number the error_number
if the error_number is -128 or the error_number is -1708 then
else
display dialog "There are no unmountable volumes."
buttons {"OK"} default button 1
end if
end try
else
set actiondisks to {}
set allvols to paragraphs of (do shell script "diskutil list -plist |
grep -o 'disk[0-9][a-z][0-9]*'")
repeat with i in allvols
if i is not in actiondisks then
set actiondisks to actiondisks & i
end if
end repeat
repeat with myitem in actiondisks
try
do shell script "diskutil mountDisk /dev/" & myitem
end try
end repeat
end if
say "Done" using "Alex"
-------------------- end script
--
Thanks,
Dave - DealTek
email@hidden
[db-17]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden