# Hyphen vs Underscore in file names?



## charlieclouser

OK, this is one for the hard core Windows guys:

Is there any danger to using the hyphen character (-), or just a space, instead of underscore (_) in file names in current versions of Windows? 

I'm only talking about audio files, WAV samples, Kontakt instruments, etc. I realize there are certain conventions that must be observed when dealing with web design files, but I'm not talking about that stuff.

I'm also not talking about backwards compatibility with Windows 95, Commodore-64, etc. - just current and future versions of Windows, so I guess Windows 7+10+up.

I'm not contemplating a platform switch, but I've always been curious as to why every sample developer is so in love with the underscore character instead of the hyphen. My own Mac-based sample library is absolutely FULL of files with the hyphen, and almost no occurrences of the underscore. If I ever did contemplate the switch, being forbidden from using space or hyphen would put an end to that plan.

So what say you Windows experts? Does Windows cough up a hairball when it sees a hyphen or a space in filenames? Does searching, indexing, etc. not work as well with these characters as it would with underscores?

Just curious.


----------



## synergy543

Not a Windows expert by any means, however you might also consider backups. Some backup devices and cloud services do restrict certain characters. So while its not a problem on the Mac itself, it could be a problem for backups. The same is true of file syncing if you might ever be syncing folders to another machine. I've had trouble backing up Mac files to a ZFS server as well as syncing to Linux and Windows machines. For this reason, it might be good to conform to basic characters. I believe both dash- and underscore_ are considered acceptable across most platforms but maybe a real expert will chime in here with more details.


----------



## Gerhard Westphalen

There are many Windows files with hyphens so I don't ever see it being a problem. I personally prefer to just use spaces. Certain programs don't like spaces which is where I use underscores. In Linux OS's I normally use underscores by default as I've always had issues using spaces.


----------



## Mike Greene

This is a really interesting question and I've often wondered the same thing. I don't really know the answers, but in my own work, and speaking only for myself in that regard, here's one reason I'll use underscores:

When I double-click a name which is made up of a bunch of words, if the words are separated by an underscore (snare_soft_01), then the entire name gets selected when it's double-clicked. Whereas if there's a hyphen (or spaces) between the words in a name (snare-soft-01), I won't get the whole name, just a single word of it. So the underscore is just a convenience.

Until I started making sample libraries, by the way, I *never* used underscore.


----------



## Mike Greene

I checked just now and we have lots of sample names with spaces, as well as hyphens, in them and there haven't been any issues with Windows customers. (Gerhard had already said that hyphens and spaces are okay, of course, but I had to look for myself.  )


----------



## Zhao Shen

Nope, both are fine. As a programmer though, I feel the urge to demand that you go with camel case or underscore. Hyphens suck.


----------



## tack

Zhao Shen said:


> As a programmer though, I feel the urge to demand that you go with camel case or underscore. Hyphens suck.


As-another-programmer-type-guy, IFeelThatConsistency is_far_more_important_than_convention.


----------



## tack

Also, if you prefix your filenames with dates, you must use the ISO format YYYY-MM-DD. Using anything else is morally reprehensible.


----------



## mjsalam

Zhao Shen said:


> Nope, both are fine. As a programmer though, I feel the urge to demand that you go with camel case or underscore. Hyphens suck.



+1 for camel case here.


----------



## charlieclouser

Well, I have lots of files with names like these:

EPB-106-Mega Bass-A.aiff

and:

violins-8d STACC-rr3-D#3.wav

So there's a mixture of hyphens and spaces in there, but rarely (if ever) an underscore. Just hoping that won't cause snags down the line if I ever need to migrate to Windows and convert 10tb of samples over.

A side question - does Windows fully support files with these extensions:

.aif

.aiff

.aifc

etc. etc. etc. Any snags with dealing with non-WAV files on Windows?


----------



## lp59burst

tack said:


> Also, if you prefix your filenames with dates, you must use the ISO format YYYY-MM-DD. Using anything else is morally reprehensible.


Uhh-ohh... now I've done it... I thought MM-DD-YYYY was the standard... now I have 20 years of files to re-do...


----------



## tack

lp59burst said:


> Uhh-ohh... now I've done it... I thought MM-DD-YYYY was the standard... now I have 20 years of files to re-do...


The moment you have a huge list of files that, when sorted lexically don't match chronological order, you will truly appreciated the folly of your ways


----------



## bryla

lp59burst said:


> Uhh-ohh... now I've done it... I thought MM-DD-YYYY was the standard... now I have 20 years of files to re-do...


in the US MM-DD-YYYY is the standard in writing. Some places in Europe it is DD-MM-YYYY (which is a bit more logical sequentially). The ISO standard however lists each file chronologically in your folder:

2013-12-20
2014-05-17
2015-12-03

Whereas the format you said would be:

05-17-2014
12-03-2015
12-20-2013

And the European:

03-12-2015
17-05-2014
20-12-2013


----------



## heisenberg

tack said:


> Also, if you prefix your filenames with dates, *you must use the ISO format YYYY-MM-DD*. Using anything else is morally reprehensible.





tack said:


> The moment you have a huge list of files that, when sorted lexically don't match chronological order, you will truly appreciated the folly of your ways



Thanks for the useful tip. Much appreciated.


----------



## mouse

I work on Pc and a client works on Mac. When I send them WAV files they said they have issues importing anything with a dash as it can cause issues on some program (not sure which). Now I just use underscore as it ensures there are no issues


----------



## babylonwaves

charlieclouser said:


> violins-8d STACC-rr3-D#3.wav


if you can use a "#" you can use a "_" as well ... both are totally fine. what you should avoid are "/", "\" and ":" because those can cause issues. and don't use a "." at the beginning of a filename because that means the file is hidden.

here's a more complete list: 

http://stackoverflow.com/questions/...orbidden-in-windows-and-linux-directory-names
https://kb.acronis.com/content/39790


----------



## GdT

I always avoid making filenames with a space in them. They caused some problems in the past but I can't quite remember why. I think this harps back to old days of DOS - remember that? Like Mac terminal commands, etc.
So it might be some backup engines might not like them.


----------



## mverta

I_use_underscore_so_much_I_sign_my_posts_with_it.

_Mike


----------



## higgs

tack said:


> Also, if you prefix your filenames with dates, you must use the ISO format YYYY-MM-DD. Using anything else is morally reprehensible.



2017-03-09-I-couldnt-agree-more.m4a

*<file-naming-OCD>*
Strictly for window/finder sorting and searching purposes (and being a non programmer), I sometimes use an underscore for the first character of my master filename from which I intend to export the final various filetype permutations, and it looks a little something like this:

_Song-Master-24-96.wav
_Song-Master-24-48.wav

Does that make the programmers here cringe? I've always wondered.

I remember the old DOS and early Windows releases didn't like spaces much. I'm on Mac now so this hasn't been on the radar for me since Y2K. Has that all been sorted out?





mverta said:


> I_use_underscore_so_much_I_sign_my_posts_with_it.
> 
> _Mike


It's odd that your signature doesn't appear at the very top of this discussion.
*</file-naming-OCD>*

Great thread!


----------



## lux

I use underscore everywhere as to my eyes it mimicks a space and reads almost like it. When having long lists of songs and/or samples then readability plays definitely a major role to me.


----------



## benatural

I use underscore because it's easy to read (low visual profile) and it's easy to rename specific components (i.e. stuff in between the underscore) of the file name by double clicking. When you double click Windows highlights that part of the name only which is more expediant than a click-drag highlight or manually deleting one character at a time.


----------



## synthetic

Semi-related: For Mac users there's a program called A Better File Rename that I use all the time. You can replace text in filenames, create sequence lists, add text to the beginning or end of a filename, truncate filenames, all kinds of stuff.

http://www.publicspace.net/ABetterFinderRename/index.html

Especially handy for handheld recorders or digital cameras. Change the filename to something useful in a sequence. Also good for preparing filenames for sampler auto-mapping. 

Personally I find underscores easier to read. And I'm in the habit of all lower case due to web development. CRMs can get confused with links using upper case letters.


----------



## charlieclouser

benatural said:


> I use underscore because it's easy to read (low visual profile) and it's easy to rename specific components (i.e. stuff in between the underscore) of the file name by double clicking. When you double click Windows highlights that part of the name only which is more expediant than a click-drag highlight or manually deleting one character at a time.



Ahh, now here we see a big difference between Mac and Windows - on a MacOS system, when a file uses a string of text separated by underscores instead of spaces, double-clicking one word in the file name selects the WHOLE string of text. In other words, on MacOS, the underscore character "counts" as text, but hyphens and spaces do not. This is the main reason why I use A Better Finder Rename (and other batch renaming tools) to swap out underscores for hyphens and spaces. That way I can double click on a single word in a long, complex name, and re-type or paste text into just that one word. 

So that's one pretty big difference...


----------



## mouse

GdT said:


> I always avoid making filenames with a space in them. They caused some problems in the past but I can't quite remember why. I think this harps back to old days of DOS - remember that? Like Mac terminal commands, etc.
> So it might be some backup engines might not like them.


Actually maybe that's it. Could be the spaces rather than dashes that cause the problem


----------



## benatural

charlieclouser said:


> Ahh, now here we see a big difference between Mac and Windows - on a MacOS system, when a file uses a string of text separated by underscores instead of spaces, double-clicking one word in the file name selects the WHOLE string of text. In other words, on MacOS, the underscore character "counts" as text, but hyphens and spaces do not. This is the main reason why I use A Better Finder Rename (and other batch renaming tools) to swap out underscores for hyphens and spaces. That way I can double click on a single word in a long, complex name, and re-type or paste text into just that one word.
> 
> So that's one pretty big difference...



Aha, that would drive me nuts. I'm trained to use the underscore it would be tough for me to unlearn that. When I used Mac 6 years ago I used BFR too. Renamers are great in general. There's a good free one for PC called Bulk Rename Utility, really powerful and easy to use.


----------



## benatural

mouse said:


> Actually maybe that's it. Could be the spaces rather than dashes that cause the problem


In the command line for Windows (what used to be called DOS) spaces aren't natively accepted in filenames. They still aren't unless you put the string inside quotes. So in a way underscore is a holdover from that. FTPs used to have problems with spaces too, but that has seemed to have gone away and spaces are fine.


----------



## GdT

lux said:


> I use underscore everywhere as to my eyes it mimicks a space and reads almost like it. When having long lists of songs and/or samples then readability plays definitely a major role to me.


Yes I agree. Underscores are more readable than hyphens.
Only problem is they are more tricky to type as need to hit the shift key.
Maybe some technical wizard can come up with a fix to make the space bar type an underscore, when typing a filename? Now that would be useful.
Also I too use underscore as the first character of a name when I want it to sort near the top.


----------



## samphony

I just realized when copy paste time code like 01:00:03:11 into Logic Pros save as dialog field it automatically renames it to 01-00-03-11. I wish all finder rename and dialog fields would do that.


----------



## jamwerks

mouse said:


> I work on Pc and a client works on Mac. When I send them WAV files they said they have issues importing anything with a dash as it can cause issues on some program (not sure which). Now I just use underscore as it ensures there are no issues


Same experience here. Been using underscore for that reason.


----------

