I have a firewire drive with ten ‘logical’ drives. With ‘diskutil list’ I can see all the drives, even when they are not mounted (happens if the drive is powered up and all the drives have been ejected). How can I get all the names (not the identifiers) into a Applescript list or table?
Hi,
something like this
set {deviceList, nameList} to {{}, {}}
-- get device identifiers and volume names of all local volumes
set allVolumes to paragraphs of (do shell script "diskutil list | grep 'Gi\\|GB' | awk '/disk.*s/ {print $NF}'")
repeat with i in allVolumes
set volName to (do shell script "diskutil info " & i & " | awk -F' *' '/Volume Name/ {print $3}'")
if volName is not "" then
set end of nameList to volName
set end of deviceList to i
end if
end repeat
set mountedVolumes to paragraphs of (do shell script "ls /Volumes") -- list of mounted volumes
set unmountedVolumes to {}
repeat with i in nameList
if contents of i is not in mountedVolumes then set end of unmountedVolumes to contents of i
end repeat
Hallo Stefan
Du hast zur raschen Lösung beigetragen. Ich verwende die folgende, leicht abgeänderte Instruktion:
set allVolumes to paragraphs of (do shell script “diskutil list | grep ‘Gi\|GB’ | awk ‘/disk.*s/ {print $3}’”)
Besten Dank und eine gute Zeit
Lazy
Consider, that this solution doesn’t work reliably, if one of the (former) parameters
or the disk name contain space characters