Is it a bad idea for a file name to contain space and capital letters


When naming a file, (for example in OneDrive) is it a bad idea for the name to contain space and capital letters? Is there any potential conflicts it might cause? Should I use hyphen or underscore instead?

Best Answer

Certain characters and special words aren't allowed and can make a file name or folder name invalid and unacceptable to OneDrive:

  1. Certain characters have special meaning and thus aren't allowed - " * : < > ? / \

  2. On OneDrive with Sharepoint, these aren't allowed - ~ " # % & * : < > ? / \ { | }.

  3. Leading (before the filename) and trailing (after the filename) spaces in file or folder names also aren't allowed. If you're using Office 2010, you can't use "&" in file and folder names.

  4. These names aren't allowed for files or folders: .lock, CON, PRN, AUX, NUL, COM0 - COM9, LPT0 - LPT9, _vti_, desktop.ini; filenames also cannot start with ~$.

  5. "_vti_" cannot appear anywhere in a file name.

Source: Invalid file names and file types in OneDrive and SharePoint.

So, while spaces are certainly allowed in the name, you have to be careful there is no space before or after the name. Both hyphen and underscore are also allowed.

While spaces aren't likely to cause any issues, as others have pointed out, it is easier to type hypens or underscore in a Terminal command. Many advanced users thus tend to avoid spaces and use hyphens or underscores in general. In general though, spaces in names should not cause any issue with MS Office or OneNote.