You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mac File Naming

My Mac sometimes does not consistently recognize the fact that I have renamed a file. When this happens, I experience delays when using Finder to find the file using the new file name. Moreover, when I do find it in a Finder window, it shows the old name. Except that - if I use "get info" for the file - I find out that it actually has the new name I expected, even though it still does not show up that way.


As an example, if I use the MacOS Screen capture facility to capture an error or diagnostic message, it gets a name that will not be helpful when looking for it later. So I rename it to something more useful. Which is pretty sketchy, when Finder seems to think it still has the original name.


If I later see a file with a name that looks like it was created by screen capture, that I did not recently create, I might naively assume I would have changed the name if I wanted to keep it and away it goes.


Is there some kind of "meta-naming" used on a Mac that might not be updated when changing the name of a file? If so, what do I have to do to fix that?


I noticed that Spotlight has a similar problem, except that Spotlight is faster in finding the right file with the wrong name.


That is one of the reasons I ask about "meta-naming" because Spotlight seems to explicitly convert the file name to a has of some kind and that hash returns a file that is the right file, with the wrong name.


This seems to hint that there is some sort of indexing going on and the index does not consistently get updated when the file name is changed.

Mac Pro

Posted on Sep 2, 2020 12:17 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 2, 2020 3:59 PM

How to rebuild the Spotlight index on your Mac

If searching your Mac doesn’t return expected results, rebuilding the Spotlight index might help.


  1. Choose Apple menu () > System Preferences, then click Spotlight.
  2. Click the Privacy tab.
  3. Drag the folder or disk that you want to index again to the list of locations that Spotlight is prevented from searching. Or click the Add (+) button and select the folder or disk to add.
  4. To add an item to the Privacy tab, you must have ownership permissions for that item. To learn about permissions, choose Help from the Finder menu bar, then search for “permissions.”
  5. From the same list of locations, select the folder or disk that you just added. Then click the Remove (–) button to remove it from the list.
  6. Quit System Preferences. Spotlight will reindex the contents of the folder or disk.


Manually Rebuilding Spotlight via Terminal

If the aforementioned Spotlight control panel approach doesn’t spur a reindexation of the drive, you may need to initiate it manually through the command line. Open Terminal and use the following command string to do so:


sudo mdutil -E /

This basically asks for temporary super user status, which is why Terminal may ask you for your password (it may not if you’ve used a sudo command recently or are already logged in as a super user or root. The command asks the unix tool mdutil to reindex the spotlight database for everything on the computer, including external drives, mounted disk images, etc. To re-index only for a specific drive, use the /Volumes path. For example, for an external drive named “MiniMe,” the command would look like this:


sudo mdutil -i on /


Rebuilding a drive index can take a long time, so be prepared to wait whether you do it through the System Preference panel or the command line.

Similar questions

7 replies
Question marked as Top-ranking reply

Sep 2, 2020 3:59 PM in response to ewgray2k

How to rebuild the Spotlight index on your Mac

If searching your Mac doesn’t return expected results, rebuilding the Spotlight index might help.


  1. Choose Apple menu () > System Preferences, then click Spotlight.
  2. Click the Privacy tab.
  3. Drag the folder or disk that you want to index again to the list of locations that Spotlight is prevented from searching. Or click the Add (+) button and select the folder or disk to add.
  4. To add an item to the Privacy tab, you must have ownership permissions for that item. To learn about permissions, choose Help from the Finder menu bar, then search for “permissions.”
  5. From the same list of locations, select the folder or disk that you just added. Then click the Remove (–) button to remove it from the list.
  6. Quit System Preferences. Spotlight will reindex the contents of the folder or disk.


Manually Rebuilding Spotlight via Terminal

If the aforementioned Spotlight control panel approach doesn’t spur a reindexation of the drive, you may need to initiate it manually through the command line. Open Terminal and use the following command string to do so:


sudo mdutil -E /

This basically asks for temporary super user status, which is why Terminal may ask you for your password (it may not if you’ve used a sudo command recently or are already logged in as a super user or root. The command asks the unix tool mdutil to reindex the spotlight database for everything on the computer, including external drives, mounted disk images, etc. To re-index only for a specific drive, use the /Volumes path. For example, for an external drive named “MiniMe,” the command would look like this:


sudo mdutil -i on /


Rebuilding a drive index can take a long time, so be prepared to wait whether you do it through the System Preference panel or the command line.

Sep 2, 2020 1:02 PM in response to ewgray2k

Macs assume that if you add a period at the end of the name, you are going to indicate a document type that it will attempt to associate with an applicaiton.


Macs assume if you enter a period at the beginning of a name, you want the file to be invisible.


Macs use / slash for directory paths, and adding those to names may confuse the Mac if you want the file to reside in a directory, or that to be part of the name.


.pkg files are assumed to be packages

.dmg files are assumed to be disk images.

.zip files are compressed files.

.png files are an image format for web based images on more recent web browsers and the default naming convention for screen captures. Preview allows you to export these to PDF, TIFF, or JPG.

Sep 2, 2020 2:38 PM in response to a brody

Thanks for the quick response. I am reasonably familiar with Unix and Unix-like file naming conventions, and I changed only the prefix (which I would have changed in any case, because - like Unix - I really hate file names with spaces in them).


Finder gets really huffy about efforts to change a suffix anyway.


To provide a specific example of the problem, if I change the name "Screen Capture 2020-08-28 at 4.21.01 PM.png" to "81264040.png," when I search for the file using the name "81264040.png" using either Finder or Spotlight, sometimes I find a file named "Screen Capture 2020-08-28 at 4.21.01 PM.png" - which, when I use "Get Info" turns out to be the actual file I am looking for ("81264040.png").


Using the entire name in a search is the easy case. If I only remember that the file I am looking for starts with "812640..." I will find several files, most of which will have a name far removed from the one I am looking for (including a couple that only get listed because I use those files to keep track of content summaries) - but those that start with "Screen Capture ..." have to be looked at to determine what they really are.


It's just a naming issue; if I try to find the file using either Finder or Spotlight and looking for the old name, it does not come up (and probably doesn't exist any more).


Maybe the problem will just go away after a couple of days...

Mac File Naming

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