Filenames: Which characters to use,
Which characters to avoid

Filenames can be one of the trickiest and most subtle problems that face web developers who have not learned these lessons the hard way. The following restrictions and recommendations are based on the reserved characters that each of the major OS platforms: UNIX, Windows and Macintosh.

Recommended Characters

Filenames for all files need to use the following characters only:

[a-z] Lowecase alphabetical characters
[0-9] Numerals
[-] Hyphens (Dashes)
[_] Underscores

Use underscores to separate major phrases in a filename. Use dashes to separate minor phrases. The goal is consistency.

Restricted Characters

These characters that are not allowed because they are reserved by the operating systems. UNIX is case-sensitive, so it's a good idea to just stick to one set of characters. Mixed case filenames are easily mistyped.

Character Definition Main Reason for Restriction
[A-Z] Uppercase alphabetical characters UNIX is CaSe SensItiVe
/ (foreslash) Reserved for Windows
\ (backslash) Reserved for Windows
| (vertical bar) Reserved for Windows
: (colon) Reserved for MacOS
; (semicolon) Reserved for Windows
, (comma) Reserved for Windows
< (less than sign) Reserved for Windows
> (greater than sign) Reserved for Windows
" (quotation marks) Reserved for Windows
  the space character Reserved for Windows
. (Periods can only be used preceding an extension.) Reserved for Windows / Common file identification method

Filename Extensions

All filenames must have a period and an extension that represents the file's format:

.jpg or .jpeg (Be consistent within a single site)
.aiff or .aif
.mpeg or .mpg

Do research if you have others that aren't on this list.

Folder / Subdirectory names

All subdirectories should be named something that is easy to pronounce and communicate over the phone. Subdirectories that are named after a noun should use the plural form of the noun. Subdirectories cannot have spaces in them, and they must follow the previous character restrictions.


[ Read and write comments ]