Name of mounted volume disc drive

I can get a list of all the mounted volumes

set disk_names to (list disks)

and find the startup disc

set sdisk to path of startup disk

but how do I find the name of the mounted disc drive?

Do you mean this

set sdisk to boot volume of (system info)

That returned my hard drive.
I’m looking for the cd/dvd drive

try this, I tried several media, all tested kinds (audio-cd, data-cd, video-dvd, data-dvd) have free disk space 0

tell application "System Events"
	1st disk whose ejectable is true and free space is 0
end tell

Of course, that’ll error if there is no disk in the drive.

see also :wink:

Hi Guys,
I notice that :

will return mounted DMG’s even if I have a Cd in the drive.

Just playing, As I have not played with AS for a while… I’m sure this can be stripped down… but it will return on Cd in the drive.

	set get_it to do shell script "drutil status -drive internal| grep -ie Name"
	set devdisk to (characters (offset of "/" in get_it) thru -1 of get_it as string)
	set DiskName to (do shell script "diskutil info " & devdisk & "|grep -ie 'Mount Point:'")
	set get1 to do shell script "basename " & quoted form of (characters (offset of "/" in DiskName) thru -1 of DiskName as string)
end try

Thanks Mark for the clarification.
I don’t like diskutil list or diskutil info because it’s terribly slow.
Just for fun I wrote a foundation tool CLI which uses the Diskarbitration.framework


discName returns the name of the inserted media of an optical drive, which is specified by an integer number.
If the number is 1 or omitted, the information is taken from the internal drive.
If no media is inserted or some other error occurs, the exit value is not 0 and an AppleScript error will be thrown

Save discName where ever you want and run it with

do shell script "/path/to/discName"

Nice Stefan,

I feel the same about diskutil list and diskutil, Your CLI tool is 4 - 5 seconds quicker. Much better.

I tried a couple of disks (that had names that showed up on the desktop) and in each case the answer was “(null)”, quotes included.

Hm, actually all errors and nil values are caught