Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

If Spotlight does not find a file or a file's contents System
Sometimes Spotlight does not find a file or a file's contents when searching and re-indexing does not help with it.

The culprit was a wrong permission on the file, which was generated when saving it from one Mac to another via Go » Connect to Server. When trying to move such a file from one folder to another on the destination Mac, it always asked for the Administrator password.

It turned out that such file had permissions as 'Nobody Read and Write.' Adding the Administrator as Read and Write did not help to find it with Spotlight.

The workaround is to create a new folder, drag and drop the files or folders containing files that are not found by Spotlight, select this new folder, do File » Get Info and check Apply to enclosing items to change the permissions.

Like magic, a second later Spotlight finds such files and their contents.

What I do not know is if there is a way to automatically find and repair the permissions of such files, other than doing it manually on a one-by-one basis, or for the whole user account home folder.

[crarko adds: I can't say I've seen this particular one before, but it does seems logical that Spotlight wouldn't index a file that has no read permissions. The other question to ask is how the permissions got whacked in the first place.]
    •    
  • Currently 3.80 / 5
  You rated: 4 / 5 (5 votes cast)
 
[30,837 views]  

If Spotlight does not find a file or a file's contents | 10 comments | Create New Account
Click here to return to the 'If Spotlight does not find a file or a file's contents' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
If Spotlight does not find a file or a file's contents
Authored by: arcticmac on Nov 07, '11 07:42:46AM

I think I've seen something similar when copying between afp shares too, but over ab NFS mount, the default is to preserve the uid and gid of files. So if a user is uid 503 on the server, the user with that ID on the local machine owns the file. If there is no user 503 on the local machine then no one owns it.

The reason that adding admin read/write priveledges doesn't work(I think) is that when adding new users, the get info panel adds ACLs, which doesn't change the fact that the file doesn't have an owner. Of course, that shouldn't matter, so it's probably a bug, but...



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: BiL Castine on Nov 07, '11 08:28:40AM
To find files with no owner or no group assigned, fire up the terminal and type or paste in
find -x (folder name) \( -nouser -or -nogroup \) -print
Replace (folder name) with the path to the folder you want to search. Searching your entire hard drive can take a while.

[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: tempel on Nov 07, '11 09:32:40AM

Using the "find" terminal cmd is IMO the worst way to perform file searches.

I recommend use a GUI tool such as EasyFind or Find Any File. Both not only present the results much better than "find" can, but also are much faster when you search the entire disk because they use advanced search functions ("CatalogSearch") that "find" doesn't.

The latter app (FAF, which is my app, BTW) even lets you perform the search as root user, making it find even those items that have the permissions set like the hints author mentioned.



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: drudus on Nov 07, '11 02:09:57PM

The beauty of the 'find command' is that you can use -delete as the last argument (instead of -print) & it will removed the offending files.
You can also get even more power by using the -exec argument to process the files with other commands, so you could 'chown myusername' the found files & chmod the correct read/write/execute attributes.

When issues like this are caused by network shares you may need to fix the files on many machines - a one line 'find snippit' can fix them all, drop it into an automator script if non geeks need to use it.

Try doing that with a GUI app.



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: rombaldi on Nov 07, '11 12:21:33PM

A genius at an apple store prescribed the following on permissions:

When you use the Disk Utility app and Repair Permissions ó it doesnít actually repair the permission settings on folders and files in your Home folder where your documents and personal applications reside.

In Lion, there is an additional Repair Permissions application utility hidden away. This tool is located inside boot Repair Utilities. Hereís how to access it.
1 Restart Lion and hold down the Command and R keys.
2 You will boot into the Repair Utilities screen. On top, in the Menu Bar click the Utilities item then select Terminal.
3 In the Terminal window, type resetpassword and hit Return.
4 The Password reset utility launches, but youíre not going to reset the password. Instead, click on the icon for your Macís hard drive at the top. From the drop-down below it, select the user account where you are having issues.
5 At the bottom of the window, youíll see an area labeled 'Reset Home Directory Permissions and ACLs'. Click the Reset button there.
The reset process takes a couple of minutes. When itís done, quit the programs youíve opened and restart your Mac. Notice that 'Spotlight' starts re-indexing immediately.



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: BiL Castine on Nov 08, '11 09:50:56AM

wow, this should totally be a separate hint.



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: fud on Nov 10, '11 12:13:27PM

Repairing USER permissions using the Lion Recovery partition fixed all my Spotlight problems. Also seemed to fix my Finder View Options randomly not sticking. I did before and after on a few directories in the terminal, and have no idea how my USER permissions were so messed up. Now I wonder if this shouldn't be part of a major system update, or user account migration.



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: Kev Dion on Sep 03, '12 11:13:20AM

It didn't work for me, Spotlight didn't automatically start re-indexing after restart. Any further suggestions?



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: Kev Dion on Sep 03, '12 02:04:59PM

Yes it did, I am just a moron



[ Reply to This | # ]
If Spotlight does not find a file or a file's contents
Authored by: aMacUzur on Nov 07, '11 03:49:57PM

I would hope that everyone realizes that Spotlight really can't find any file on your disk — there are only certain folders that Spotlight does and can scan/search. It seems that there's no way to get Spotlight to scan/search the entire boot/system disk as there are areas (such as the system area) it won't seem to scan ('though I haven't tried this with 10.7, having given up on Spotlight "way back when").

If you want to find files and/or content anywhere on your disk, you can use the following free applications (ask Mr. Google where to find 'em)

  • Find Any File : quite fast for finding folders and files (doesn't do content)
  • EasyFind: not quite as fast for finding files as "Find Any File," but it has some different capabilities and can also find content (which is even slower)

Neither of the above utilities use any kind of indexing (well, other than the disks filesystem services) so they're always up-to-date, don't consume resources for scanning and don't get corrupted ... i.e., although a little slower, they're reliable and search anywhere on your disk.

At least we no longer see Apple's web pages making the "find any file on your disk" claim. <sigh>



[ Reply to This | # ]