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

Finder: Dashes vs Underscores

I've just discovered, when searching for a file named with dashes such as "file-test-test.anything", Finder cannot see it if I search without dashes; "file test test.anything". Finder can see it if I use underscores, but then any files posted to the web will be viewed as one word if underscores are used.


This seems like very odd behavior as the recommended naming convention for files in programming and SEO is with dashes.


I do not want to search with dashes - any advice?

iMac, macOS Sierra (10.12.4)

Posted on Apr 24, 2017 10:53 AM

Reply
6 replies

Apr 24, 2017 11:27 AM in response to Yaphet from NYC

i rename two image files as such:


File_with_dashes.png

File-with-dashes.png


I then did a Spotlight search for File with dashes and got the following:

User uploaded file

Both were found. I'm ruining 10.12.4.


Download and run Etrecheck. Copy and paste the results into your reply. Etrecheck is a diagnostic tool that was developed by one of the most respected users here in the ASC and recommended by Apple Support to provide a snapshot of the system and help identify the more obvious culprits that can adversely affect a Mac's performance.

User uploaded file

Apr 24, 2017 11:43 AM in response to Yaphet from NYC

Hello Yaphet,

Spotlight searching can be confusing. The default behaviour is to search the contents of file, not the names. Only after you have a few thousand useless hits will you be offered a chance to do an actual file name search. Then the string can be found easily.


I'm not familiar with SEO, but the standard file naming convention for most computer issues is to use underscores. Dashes have special meaning and make life difficult. Spaces do the same thing. Underscores are just ugly, but otherwise don't have any negative impact.

Apr 24, 2017 5:26 PM in response to etresoft

Thanks Etresoft,


You would assume the file name would be weighted before contents.


Spotlight and Finder are actually interchangeable, even though they are named differently correct? I had a chat with someone in Apple Support and they were able to replicate my situation which explicitly was searching in a Finder window for a file stored in iCloud Drive. Apologies for failing to mention the iCloud Drive part in the original question.


re: SEO - this was an image file that I was uploading to my website, where a file-named-like-this.png is recognized by Google as separate words, and a file_named_like_this.png is recognized as all one word. Additionally, files created by programmers are usually named with dashes also, at least in the lessons I've taken. I find this behavior very odd, and never discovered it before as most of my files have been named with spaces in them for legibility.

Apr 24, 2017 6:43 PM in response to Yaphet from NYC

Hello again Yaphet,

Spotlight is difficult to test and not at all reliable. If I manually create a scenario to test what you describe, then it works as you would expect. It does search by both contents and file names and prioritizes the file name. But I have never seen it work like that in the real world. If I actually don't know where the file is or what it is named, then I get back 100,000 results. In most cases, the file I want is in a folder that Spotlight does not search at all.


Spotlight and Finder are completely different things. Spotlight is the search technology used to search for pretty much anything on the disk. It is also responsible for for categorizing files into 20% music, 10% backups, 10% movies, 10% images, 10% apps, and 80% other.


I see your point about the SEO. The only time I see files named with dashes is when an alternative, like ":", "/", or "." is unacceptable for some technical reason. Usually files with dashes are fine, as long as the file doesn't start with a dash. Don't ever do that. Technically, there is nothing wrong with spaces, but you have to hope that every single script that is going to process your file has the correct logic for handling spaces. They do use the correct logic about 80% of the time.

Finder: Dashes vs Underscores

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