• 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: Adding Spotlight Metadata
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Spotlight Metadata


  • Subject: Re: Adding Spotlight Metadata
  • From: Axel Luttgens <email@hidden>
  • Date: Sat, 7 Nov 2009 14:51:08 +0100

Le 5 nov. 2009 à 23:34, Hagimeno a écrit :

Hi Axel,

Yes -h is help but can't say nothing about your -x parameter...
I try xattr -w -x myMetaSize 10 filepath but return me error
At the moment I can only assign "string" value not Real or Integer.
How I can do this???

Hello Steve,

Unless I'm wrong, an extended attribute is basically a name/value pair associated to a filesystem item (file, folder...), where the value is an arbitrary sequence of bytes.
That is, extended attributes aren't typed; it's up to the user (or to an application) to decide how to interpret that sequence.


So, for example, let's create a file with an extended attribute:

	luttgens$ touch myfile
	luttgens$ xattr -w myattr abcde myfile
	luttgens$ xattr -p myattr myfile
	abcde
	luttgens$ xattr -p -x myattr myfile
	61 62 63 64 65

Here, it thus appears that the xattr utility by default interprets those sequences of bytes as strings:

	luttgens$ xattr -w -x myattr '66 67 68 69 70' myfile
	luttgens$ xattr -p myattr myfile
	fghip

So, should you insist on writing a numeric value in a "binary" format instead of a textual representation, you would have to decide on a storage size -for example 4 bytes- and a storage order - for example big endian:

	luttgens$ xattr -w -x myMetaSize '00 00 00 0A' myfile
	luttgens$ xattr -l myfile
	myMetaSize:
	00000000 00 00 00 0A                 |....|
	00000004
	myattr: fghip
	luttgens$ ls -l@ myfile
	-rw-r--r--@ 1 luttgens luttgens 0 7 nov 13:53 myfile
		myMetaSize	4
		myattr	5


HTH, Axel

_______________________________________________
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
  • Prev by Date: Re: spurious timeout on nth Apple event on Snow Leopard
  • Next by Date: Re: AppleScript-Users Digest, Vol 6, Issue 570
  • Previous by thread: Re: Adding Spotlight Metadata
  • Next by thread: Is there a decent IRC channel for AppleScript Users?
  • Index(es):
    • Date
    • Thread