Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

else if

I have an external drive that is partitioned. One of the drives is PRO FULL 1 L. I want to be able to unmount the partition if it exists and do nothing if it does not exist. I have come up with the following which works fine if the partition exists, but can't figure out what to add to script (else if?) to deal with the situation if the partition does not exist. (running Catalina )


Thanks


---PRO FULL 1 L


if exists (do shell script "diskutil unmount /dev/disk4s2") then


end if




---PRO FULL 1 L - data


if exists (do shell script "diskutil unmount /dev/disk4s1") then


end if

iMac Line (2012 and Later)

Posted on May 18, 2020 4:49 PM

Reply
Question marked as Best reply

Posted on May 18, 2020 5:00 PM

Use code such as:


tell application "Finder"

if exists disk "PRO FULL 1 L" then (do shell script "diskutil unmount /dev/disk4s2")

if exists disk "PRO FULL 1 L - data" then (do shell script "diskutil unmount /dev/disk4s1")

end tell


(180936)

Similar questions

2 replies

else if

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.