• 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: Unique Identifier for Disk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unique Identifier for Disk


  • Subject: Re: Unique Identifier for Disk
  • From: Michael Ziober <email@hidden>
  • Date: Thu, 29 Apr 2004 14:33:46 -0700

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>)

  • Prev by Date: UI Scripting Network...
  • Next by Date: Now up to date/Filemakeer
  • Previous by thread: Re: Unique Identifier for Disk
  • Next by thread: Re: auto backup Applescript?
  • Index(es):
    • Date
    • Thread