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: Unique Identifier for Disk



On Apr 29, 2004, at 4:29 AM, Jeffrey Berman wrote:

Because the particular volume I am trying to track is on the device also
containing the startup volume, it sounds like the relevant disk device file
will always start with "disk0". If the minor number representing a specific
partition remains constant across restarts, the device file name for that
volume (e.g., "disk0s10") could serve as an identifier across restarts.

Then I could depend on getting the current name of the disk object for use
in AppleScript with:

do shell script "df -t hfs | awk -F/ '/disk0s10/ {print $5}'"

As long as the focus is on disk objects on the same physical disk as the
startup disk, does anyone see a flaw in using this approach as a way to
identify a disk in AppleScript even if the name of the disk changes?

Assuming that you plan to capture the output and use it as a disk name in the Finder or System Events, I will only caution you that the above shell script does not translate ":" characters in the BSD name space to "/" characters in the HFS name space. (Just in case your volume gets renamed to "AC/DC", etc.)

set volumeName to do shell script "df -t hfs | awk -F/ '/disk0s10/ {print $5}' | tr ':' '/'"
tell application "Finder" to open disk volumeName

Michael
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Unique Identifier for Disk (From: Jeffrey Berman <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.