Difference between revisions of "Portable Filenames"

From Gramps
Jump to: navigation, search
(Recommendations: improved accuracy)
m (External links: added link)
Line 117: Line 117:
* [http://www.xaprb.com/blog/2005/11/17/maximizing-filesystem-portability/ How to make file names cross platform]
* [http://www.xaprb.com/blog/2005/11/17/maximizing-filesystem-portability/ How to make file names cross platform]
* [http://www.ordersomewherechaos.com/rosso/webdev/filenames/ Filenames: Which characters to use, Which characters to avoid]
* [http://www.ordersomewherechaos.com/rosso/webdev/filenames/ Filenames: Which characters to use, Which characters to avoid]
* [http://www.portfoliofaq.com/pfaq/FAQ00352.htm Mac and Windows OS File/Folder naming rules]

Revision as of 22:45, 21 July 2008

In order to be able to move our media files from one computer to another it is critical that the names of our files can be understood by the different file systems and encodings they meet.

To find a set of characters which can meet all these criteria this article is originally based on content from Wikipedia Online Encyclopedia, especially the articles Filenames, Comparison of file systems and ASCII character encoding and Naming a File from MSDN. Please add other references to improve this article.


If you follow the rules below your directories and files will be handled without issues on all of the following: servers, USB drives, CD's, DVD's, Blue Ray discs, HD DVD's, hard drives formatted with FAT32, NTFS, EXT2/3, Windows from '95 onwards, POSIX compliant systems (Linux, Unix, OSX) and much more...

Not supported are CD's and DVD's using the file format ISO 9660 level 1. This is very unlikely to be an issue for you unless your operating system is from before 1995 (Joliet extensions to ISO 9660).

Safe characters

  • a-z Lowercase alphabetical characters (see below)
  • A-Z Uppercase alphabetical characters (see below)
  • 0-9 Numerals
  • - Hyphens/ dashes (see below)
  • _ Underscores
  • . Period/ full stop (see below)

Safe character use

The characters from the list of safe characters must be used with a little care.


There are limits imposed by operating systems and file formats. The lowest of each of these limits (for systems after 1994) is listed below.

  • The number of nested directories must not be more than eight (root plus seven) (limit of ISO 9660)
  • The number of directories to 65,535 (limit of ISO 9660) on Windows)
  • The length of a file path to 256 characters (limit of Windows Path Size)
  • The length of a file name to 31 characters including the period and extension (Limit of the Macintosh HFS file system)
  • The size of files to 2 GiB (limit of ISO 9660 and Macintosh HFS file system)

Illegal file names

  • CON, PRN, AUX, CLOCK$, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9 (ref) also ., and .. (ref)

Needing clarification

The following are not recommended but I can't find any reference to why they could be a problem. They are all ASCII characters.

# number sign Yes Not reservedref
& Ampersand Yes Not reserved(ref)
' Apostrophe Yes Not reserved(ref). Some websites have trouble handling file names containing apostrophes (PHP Bug #33198)
( and ) Parentheses Template:Maybe Unclear. Reference.
+ Plus Yes Not reserved(ref)
, Comma Yes Not reserved(ref)
; Semi colon Yes Not reserved(ref)
= Equals sign Yes Not reserved. reference.
@ At sign Yes Not reserved. Reference.
[ and ] square brackets or box brackets Yes Not reserved. Reference.
^ Caret Yes Not reserved. Reference.
_ Underscore Yes Not reserved. Reference.
{ and } Curly brackets Yes Not reserved. Reference.
~ Tilde Yes Not reserved. Reference.

External links