Question: Do spaces count toward the total character limit in file or folder names?
Answer: Yes.
How I tested this.
I created a text file and named it
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.txt
The name is a 124 characters long. Uploaded it to a Document Library and it works.
Now, try adding some spaces to the file name, the re-upload the file.
You will see this error:
The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.
More info from Joel Oleson’s blog:
File Names
- Invalid characters: ” # % & * : < > ? \ / { | } ~
- Cannot be longer than 128 characters
- You cannot use the period character consecutively in the middle of a file name
- You cannot use the period character at the end of a file name
- You cannot start a file name with the period character
Folder Names
- You cannot use the following characters anywhere in a folder name or a server name: ~ # % & * { } \ : < > ? / | “
- Cannot be longer than 128 characters
- You cannot use the period character consecutively in the middle of a folder name
- You cannot use the period character at the end of a folder name
- You cannot start a folder name with the period character
update.
More info from Microsoft on this topic:
You can also use Long Path Tool for such problems, it works good…