mdfind -0 -onlyin /System 'kMDItemDisplayName == "keyedobjects.nib"' |xargs -0 ls -d
I get no results from that command, just a return to the prompt as with the /Applications argument. That's bizarre... because that command not only produces (seemingly proper, albeit incomplete) output on my MacBookPro (10.5.8) but also on a nearby iMac G5 (10.4.11), though, with less than 411 items. (BTW, the item count will vary depending on which languages users may have erased or left intact, etc).
I wish i could figure out why, because
mdfind does seem wacky at times. But i employed that approach you found to come up with a way of using mdfind to find stuff inside bundles. I am working on a shell script called fbi ("Find Bundle Items"), but parts of it lend themselves to 'one-liners' suitable for this forum exchange we're having. If you're into it, see how these perform on your delicata...
# DUAL MDFIND + XARGS:
mdfind -0 -onlyin /Applications 'kMDItemContentTypeTree == com.apple.bundle' |
xargs -0 -n1 -I% mdfind -0 -onlyin % 'kMDItemDisplayName == designable.nib' |
xargs -0 du -k |awk '{ siz+=$1; print } END { if (NR > 0)
printf("=====\n%.2f megs total for %d items.\n", siz/1024, NR) }'
# WHILE-READ DO LOOP:
mdfind -onlyin /Applications 'kMDItemContentTypeTree == com.apple.bundle' |
while IFS= read -r b; do mdfind -0 -onlyin "$b" 'kMDItemDisplayName == designable.nib' |
xargs -0 du -k; done |awk '{ siz+=$1; print } END { if (NR > 0)
printf("=====\n%.2f megs total for %d items.\n", siz/1024, NR) }'
In both cases, all 4 lines can be copy/pasted as a whole. If the long listing gets tiresome, take out the first 'print' command. The basic variables are the folder to search (/Applications) and the name to match (designable.nib). [i have been using "keyedobjects.nib" for my tests here, because
every single designable.nib has been
purged from my disks since mid-to-late April 2008.]
--
Those two pipelines work perfectly fine on my HD.
However... changing the folder path from /Applications to /Volumes/*/Backups.backupdb reveals some really strange mdfind behavior. Instead of finding files by kMDItemDisplayName like it should, it starts returning all sorts of stuff with
different names. I'm still trying to crack that egg... but it sure looks like a bug to me. Here is a summary showing the flaw (compares mdfind on HD, mdfind on TM backup, and regular Unix find on TM backup):
mdfind -onlyin /Applications/Mail.app 'kMDItemDisplayName == keyedobjects.nib' -count
161
mdfind -onlyin /Volumes/L_d100g/Backups.backupdb/santa-rosa/2009-11-07-002555/MacX/Applications/Mail.app 'kMDItemDisplayName == keyedobjects.nib' -count
488
find -x /Volumes/L_d100g/Backups.backupdb/santa-rosa/2009-11-07-002555/MacX/Applications/Mail.app -name keyedobjects.nib |wc -l
161
As i said, that 488 is wrong because the results list has all sorts of wrong hits (tiff files, plists, you name it).
EDIT: actually i just noticed something that didn't happen earlier: it's returning a different count for each run!
[in case it's been lost in translation, my goal is to quickly and accurately measure designable.nib waste inside Time Machine's backup. While deleting languages does simultaneously reduce the designable.nib problem drastically, i think the *accumulated* (English) nibs inside TM's incremental backups (containing multiple software update versions) is something worth measuring at least.]