• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UUID
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UUID


  • Subject: Re: UUID
  • From: Luther Fuller <email@hidden>
  • Date: Thu, 31 Jan 2008 15:19:00 -0600

On Jan 31, 2008, at 2:29 PM, Mark J. Reed wrote:
You can also get the UUID in one shell command with no subsequent modification of the output needed:

do shell script ¬
    "diskutil info /Volumes/" & ¬
        quoted form of name of adisk & ¬
    " | awk '/UUID:/ {print $NF}' "

Altneratively, you could use the -plist option to diskutil info to get the result in XML property list form, and then use XMLlib.osax to parse out what you need (it appears the standard additions plist stuff won't accept input from a string, only from a plist file).

On Jan 31, 2008 2:47 PM, Luther Fuller <email@hidden> wrote:
repeat with adisk in diskList
"diskutil info /Volumes/" & (name of adisk) & "/"


FWIW, I don't believe that ( "/Volumes/" + (name of disk) ) is guaranteed to work in all cases, since if you have two disks with the same volume name, the (name of) will return the same value for both of them, while the mount point under /Volumes will necessarily be different. This is a rare edge case that you might not want to worry about.

Given the (not necessarily unique) volume name, one way to get a unique disk identifier (the diskXsY version) is this:

set diskName to (do shell script "diskutil list | awk '($3==\"" & (name of adisk) & "\") {print $NF}'")

but that's susceptible to a more likely problem, in that it won't work if the volume name has a space in it...

True. As I discovered shortly after my last post. I should have written ...


		repeat with adisk in diskList
			"diskutil info " & quoted form of (POSIX path of adisk)
			set uuid to do shell script the result

So far, I have found that:
	all of my internal HD partitions;
	zip100 disks;
	disk image disks;
	my flash drives; and
	CD and DVD roms that I burned;
do have a uuid.

_______________________________________________
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
References: 
 >UUID (From: Luther Fuller <email@hidden>)
 >Re: UUID (From: Skeeve <email@hidden>)
 >Re: UUID (From: Luther Fuller <email@hidden>)
 >Re: UUID (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: GUIscritpting, Pages and PDF
  • Next by Date: Re: UUID
  • Previous by thread: Re: UUID
  • Next by thread: Re: UUID
  • Index(es):
    • Date
    • Thread