mdls incorrectly reports "could not find xxxx" when "Permission denied"

mdls incorrectly reports "could not find xxxx" when "Permission denied" should be reported.

see example:

/Users/dgerman > ls -ld Pic*
drwx------+ 304 dgerman admin 10336 Apr 24 19:55 Pictureso
drwx------ 5 root admin 170 May 4 21:43 Picturesrut

Users/dgerman > mdls -name kMDItemKind Pic*
kMDItemKind = "Folder"
mdls: could not find Picturesrut.

/Users/dgerman > sudo mdls -name kMDItemFSName Pic*
kMDItemFSName = "Pictureso"
kMDItemFSName = "Picturesrut"

Ibook G4, Mac OS X (10.5.6)

Posted on May 7, 2009 9:37 AM

Reply
5 replies

May 7, 2009 1:19 PM in response to dgerman

dgerman wrote:
mdls incorrectly reports "could not find xxxx" when "Permission denied" should be reported.

No, this is normal terminal behavior. If the permissions do not allow the file to be read, then it reports as not being found since it cannot see it. It's part of the security.
Similarly some commands when run as a normal user will return "command not found" but when run as sudo it runs fine.

You would do better posting in the Unix forum here:
http://discussions.apple.com/thread.jspa?messageID=9325732&#9325732
for a more detailed explanation of how these things work.

Message was edited by: nerowolfe

May 7, 2009 12:56 PM in response to sig

mdls is one of the set of utilites used to access the metadata used by spotlight and mozy backup.

examples of available metadata items include:

kMDItemContentType, kMDItemKind,
photos kMDItemExposureTimeSeconds, ...Aperture, ...FNumber, ...ISOSpeed,
...FocalLength,...ISOSpeed etc


Very terse descriptions from man pages can be found at:
http://real-world-systems.com/docs/mdfind.1.html

Official documentation is at:
http://developer.apple.com/reference/Carbon/idxFileManagement-date.html#//apple_ ref/doc/uid/TP30001281-TP30000420-TP30000448

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

mdls incorrectly reports "could not find xxxx" when "Permission denied"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.