Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UUID



Luther Fuller wrote:
It is easy to confirm, using Disk Utility, that a disk has a Universal Unique Identifier (UUID).
Is there any way in AppleScript, perhaps using 'do shell script', to read the UUID of a disk?
As no one did understand me ;-) here is a handler for you to use:

to uuid(a_disk)
return do shell script "/usr/sbin/diskutil info " & (quoted form of POSIX path of a_disk) & "/ | /usr/bin/perl -ne 'print if s/^\\s+UUID:\\s+//'"
end uuid



And here an example of how to get the UUID of every mounted disk. The result is a list of the disk names followed by a tab, followed by the UUID if any.


set uuid_list to {}

repeat with a_disk in list disks
   copy a_disk & tab & uuid(a_disk) to the end of uuid_list
end repeat

return uuid_list


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >UUID (From: Luther Fuller <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.