| Recent Articles |
No
‘iPod’ Tax For Japan
Technophile Japanese buyers of portable media players may have received a break
as a government committee declined to support a proposed tax. The money grab proposed
by the recording industry in Japan looks like it won't happen, the New York Times
reported.
Crucial support needed for the measure... Disney
To Provide 'iPod' Content Insurance
A disaster befalling an iPod usually means having to repurchase content, but a
plan from major content provider Disney will cover those lost songs and videos.
The Macsimum News website reported on a forthcoming insurance plan to be offered
by the Walt Disney Company to cover the replacement of media contained on an iPod
that gets damaged, stolen, or lost.
Steve
Jobs Ruined My Thanksgiving
I recently got an iPod Nano, mainly because I'm annoyed at the limitations of
my iPod Shuffle on long trips (like flying half way around the world). Two nights
ago, I fired up iTunes and finally accepted it's offer to upgrade from...
Driving
For ‘iTunes’
A site sponsored by Ford Motor Company offers education on driving safety and
hazards for young drivers, and rewards users for passing a quiz on their knowledge.
Ten free iTunes downloads can be had from Ford's Driving
Skills for Life site, an effort partnering the car maker with the Governors
Highway Safety Association... Blogging
Apple
A new blog kicked off yesterday about the all things Apple. The blog over at the
brilliant BusinessWeek called "Byte of the Apple" will be written by Peter Burrows,
Arik Hesseldahl and Cliff Edwards. It should provide some interesting insight
into the world of Apple... Battery
Busters: HP & Apple Recalls
California computer manufacturers Hewlett-Packard and Apple issued recalls for
lithium-ion batteries on certain notebook computers. The U.S. Consumer Product
Safety Commission (CPSC) issued the orders for both companies. Both companies'
batteries experienced the same problems, which is overheating and possible melting
due to an internal short... |
|
12.08.05 Spotlight,
Mdfind (Mac OS X Tiger Searching) By
A.P. Lawrence
Most users will probably see Spotlight as an enhanced, very fast file searcher:
something that builds an index of files and their contents, and can very quickly
search that index and return results.
Actually, Spotlight is much, much more than that, but if that's all you need,
it sure beats "find" and "grep". That's true even if all we are talking about
is finding text.
I'm not a bit interested in the GUI interface to Spotlight. It's fine for what
it is, but the command line "mdfind" is much more interesting. But before we get
to that, let's look at where Spotlight stores its index: $
sudo bash
# pwd
/.Spotlight-V100
# ls -l
total 183136
-rw------- 1 root admin 0 May 6 14:59 .journalHistoryLog
-rw------- 1 root admin 32591872 May 6 15:02 .store.db
-rw------- 1 root admin 28573696 May 6 14:55 ContentIndex.db
-rw------- 1 root admin 391 May 6 14:59 _exclusions.plist
-rw------- 1 root admin 378 May 1 20:34 _rules.plist
-rw------- 1 root admin 32591872 May 6 15:02 store.db
# cat _exclusions.plist
< ?xml version="1.0" encoding="UTF-8"? >
< !DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
>
< plist version="1.0 ">
< dict >
< key>EXCLUSIONS< /key >
< array >
< string >/Users/apl/snapshots< /string >
< string >/Users/apl/Movies< /string >
< string >/Users/apl/Music< /string >
< string >/Users/apl/Pictures< /string >
< /array >
< /dict >
< /plist >
#
Notice the EXCLUSIONS list? You can add to that with the System Preferences tool,
but this is where it is actually stored. However, as we'll see in a moment, this
is NOT all that Spotlight (and mdfind) ignores. You need to be aware of that when
using mdfind.
For the simplest use, just do "mdfind whatever". Can you use that in a script?
Why not? for
i in `mdfind Stuff`
do
scp $i me@somewhere.com:$i
done
But mdfind is much more powerful than that: mdfind
'kMDItemTextContent == "*Seneca*" && kMDItemFSName != "*emlx"'
mdfind 'kMDItemTextContent == "*Seneca*" && kMDItemContentType != "com.apple.mail.emlx"'
That's searching metadata. What metadata can you search? Well, anything that's
available and "mdls" will show you that: $
mdls t.txt t.txt ------------- kMDItemAttributeChangeDate = 2005-05-06 15:44:32
-0400
kMDItemContentCreationDate = 2003-12-15 18:11:55 -0500
kMDItemContentModificationDate = 2005-05-06 15:44:31 -0400
kMDItemContentType = "public.plain-text"
kMDItemContentTypeTree = (
"public.plain-text",
"public.text",
"public.data",
"public.item",
"public.content"
)
kMDItemDisplayName = "t.txt"
kMDItemFSContentChangeDate = 2005-05-06 15:44:31 -0400
kMDItemFSCreationDate = 2003-12-15 18:11:55 -0500
kMDItemFSCreatorCode = 0
kMDItemFSFinderFlags = 0
kMDItemFSInvisible = 0
kMDItemFSLabel = 0
kMDItemFSName = "t.txt"
kMDItemFSNodeCount = 0
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 2552
kMDItemFSTypeCode = 0
kMDItemID = 1802523
kMDItemKind = "Plain text document"
kMDItemLastUsedDate = 2003-12-15 18:11:55 -0500
kMDItemUsedDates = (2003-12-15 18:11:55 -0500) Read
the rest of the article.
About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com |