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