You may only work in one operating system, however your web files will be viewed by numerous systems. Therefore, it becomes essential that you play it safe and avoid common illegal directory and filename characters. Some are illegal because a specific operating system doesn’t support them, others because they are used as variables or reserved characters. Naming conventions are important in web addresses as well as for binary files.
Do not use any of these common illegal characters:
| # pound | < left angle bracket | $ dollar sign | + plus sign |
| % percent | > right angle bracket | ! exclamation point | ` backtick |
| & ampersand | * asterisk | ‘ single quotes | | pipe |
| { left bracket | ? question mark | “ double quotes | = equal sign |
| } right bracket | / forward slash | : colon | |
| \ back slash | blank spaces | @ at sign |
Also, keep these rules in mind.
- Don’t start or end your filename with a space, period, hyphen, or underline.
- Keep your filenames under 31 characters.
- Most operating systems are case sensitive.
- Non-ASCII characters need to be escaped.
Example:
| Bad filenames | Translates to |
| F&A Costs.html | F&A%20Costs.html |
| my PDF file#name.pdf | my%20PDF%20file%23name.pdf |
Good filenames:
- F_A_Costs/index.html or F-A-Costs/index.html
- my_PDF_file_name.pdf or my-PDF-file-name.pdf
Note: This list is not exhaustive. It is meant to help you avoid common errors in filenames.