• 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: Jeffrey Berman <email@hidden>
  • Date: Mon, 26 Apr 2004 22:15:20 -0500

On 4/26/04 4:44 PM, email@hidden wrote:

>> Is there a unique identifier for a disk that is not the startup disk
>> and that would persist over restarts so that an AppleScript script
>> referring to the disk would work as expected even if the name of the
>> disk changes?
>
> Yes, via unique UNIX identifier from which one can then obtain the
> User editable Volume Name.
>
> 'df | grep '/dev/'| awk '{print $1}'' - via 'Terminal', or
> do shell script ("df | grep '/dev/' | awk '{print $1}'") - via
> AppleScript's 'Script Editor' will display the UNIX low level
> assignment of each mounted Volume.

Will the identifier stay the same across restarts? For example, if the
device file name in the /dev directory representing a volume is "disk0s10",
will this be the same each time the machine is restarted?


> Replacing '$1' with '$6' will instead display the User's editable
> Name of the mounted Volume(s).

Using '$6' captures the path (not the name) and then only up to the first
word of a disk name if there are spaces in the name. For example, if the
name of the disk is "OS X", the syntax returns "/Volumes/OS" for that line.

One could get the disk name associated with "disk0s10" (and eliminate the
grep pipe) using the following:

df | awk -F/ '/disk0s10/ {print $5}'

However, getting the disk name this way is not of much use unless the
associated device file name in the /dev directory is unique across restarts.

Does anyone know if this is the case?

-Jeffrey Berman
_______________________________________________
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.


  • Prev by Date: Finder Window toolbar?
  • Next by Date: Re: Smile error
  • Previous by thread: Re: Unique Identifier for Disk
  • Next by thread: Re: Unique Identifier for Disk
  • Index(es):
    • Date
    • Thread