• 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: Cloaking Device
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cloaking Device


  • Subject: Re: Cloaking Device
  • From: Ron Hunsinger <email@hidden>
  • Date: Thu, 07 Jul 2011 16:03:46 -0700

On Jul 7, 2011, at 8:30 AM, Luther Fuller wrote:
> I've Googled this and found nothing. Does anyone know how to get only the volumes on a particular hardware device? Or get a list of hardware devices?

You could parse the output of the diskutil command. For example:

	set lst to do shell script "/usr/sbin/diskutil list "
	repeat with aLine in paragraphs of lst
		if aLine begins with "/dev/" then
			set itsDevice to aLine -- or text 6 thru -1 of aLine
		else if aLine contains "#:" then
			set nameBeg to offset of "NAME" in aLine
			set sizeBeg to offset of "SIZE" in aLine
			set idBeg to offset of "IDENTIFIER" in aLine
		else if aLine contains "Apple_HFS" then
			set nameEnd to sizeBeg - 1
			repeat while nameEnd > nameBeg and character nameEnd of aLine = " "
				set nameEnd to nameEnd - 1
			end repeat
			set itsName to text nameBeg thru nameEnd of aLine
			set itsID to text idBeg thru -1 of aLine
			log {itsName, itsID, itsDevice} -- or do something more useful
		end if
	end repeat

To limit to a particular device, put the name of any partition on the device after the diskutil list command. For example,

	set lst to do shell script "/usr/sbin/diskutil list /Volumes/junk"

and continue as above.

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

This email sent to email@hidden

  • Follow-Ups:
    • Re: Cloaking Device
      • From: Luther Fuller <email@hidden>
References: 
 >Cloaking Device (From: Luther Fuller <email@hidden>)
 >Re: Cloaking Device (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Cloaking Device
  • Next by Date: Re: Cloaking Device
  • Previous by thread: Re: Cloaking Device
  • Next by thread: Re: Cloaking Device
  • Index(es):
    • Date
    • Thread