Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are reserved filenames for various platforms?

I'm not asking about general syntactic rules for file names. I mean gotchas that jump out of nowhere and bite you. For example, trying to name a file "COM<n>" on Windows?

like image 966
erickson Avatar asked Sep 23 '08 17:09

erickson


2 Answers

From: http://www.grouplogic.com/knowledge/index.cfm/fuseaction/view_Info/docID/111.

The following characters are invalid as file or folder names on Windows using NTFS: / ? < > \ : * | " and any character you can type with the Ctrl key.

In addition to the above illegal characters the caret ^ is also not permitted under Windows Operating Systems using the FAT file system.

Under Windows using the FAT file system file and folder names may be up to 255 characters long.

Under Windows using the NTFS file system file and folder names may be up to 256 characters long.

Under Window the length of a full path under both systems is 260 characters.

In addition to these characters, the following conventions are also illegal:

  • Placing a space at the end of the name
  • Placing a period at the end of the name

The following file names are also reserved under Windows:

  • aux,
  • com1,
  • com2,
  • ...
  • com9,
  • lpt1,
  • lpt2,
  • ...
  • lpt9,
  • con,
  • nul,
  • prn
like image 94
Jacob T. Nielsen Avatar answered Sep 29 '22 03:09

Jacob T. Nielsen


Full description of legal and illegal filenames on Windows: http://msdn.microsoft.com/en-us/library/aa365247.aspx

like image 27
Adam Rosenfield Avatar answered Sep 29 '22 01:09

Adam Rosenfield