Illegal Filename Characters on Windows vs Mac OS

Windows vs MacCross-platform file sharing is very commonplace nowadays. This article will explain the limitations posed by Windows and Mac when it comes to naming your files and folders. It will outline which characters to avoid when you name your files or folders to ensure maximum cross-platform compatibility when you move files between Windows and Mac.

Windows File Naming Convention

The Windows operating system can use two different file systems:

  • Protected-Mode File Allocation Table (FAT) file system
  • New Technology File System (NTFS)

The two systems have much in common, but the characters permitted in a file or folder name may differ. In the conventions listed below, it is true for both systems unless otherwise specified. Specifically there are cases where NTFS does not have the limitations (see note below).

On Windows running the NTFS file system

  • do not use any of the following characters when naming your files or folders:
    • / ? < > \ : * | ” and any character you can type with the Ctrl key
  • file and folder names may be up to 256 characters long
  • the maximum length of a full path is 260 characters

On Windows running the FAT file system

  • do not use the caret ^ in your files or folder names, in addition to:
    • / ? < > \ : * | ” and any character you can type with the Ctrl key
  • file and folder names may be up to 255 characters long
  • the maximum length of a full path is 260 characters

In addition to illegal 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 names are reserved under Windows (i.e. Do not use as your file or folder names):

  • com1, com2, com3, com4, com5, com6, com7, com8, com9, lpt1, lpt2, lpt3, lpt4, lpt5, lpt6, lpt7, lpt8, lpt9, con, nul, prn

Note:

The previous conventions are true only if the application used in managing them is does not use the Unicode API. Although the file system may support most of the above mentioned conventions the operating system may not. For example, the NTFS file system allow paths to have a length up to 32,767 characters with each component (folder, file, etc.) being limited to 255 characters. However some windows applications like Windows Explorer, for example, may not behave correctly in this circumstance.

Below the Macintosh conventions will touch the fact that the colon “:” is an invalid character in the Macintosh Operating Systems. Under Windows and the NTFS file system the colon is an illegal character, because it is used to open alternate file streams. However all other characters can be moved on and off the NTFS file system if a program with Unicode support is used.

Mac OS 9 File Naming Convention

  • The only illegal character for file and folder names in Mac OS 9 is the colon “:”
  • File and folder names may be up to 31 characters in length

Mac OS X File Naming Convention

Since Mac OS X is build on top of UNIX there are a few inherent conventions that OS 9 users may not expect. Because of this, migrating certain files and folders from OS 9 to OS X may cause unexpected behavior.

  • The only illegal character for file and folder names in Mac OS X is the colon “:”
  • File and folder names are not permitted to begin with a dot “.”
  • File and folder names may be up to 255 characters in length

Examples of Unexpected Behavior

Below are a few scenarios that show what can happen if file names that are acceptable on one operating system are moved to another:

Example 1

  1. Create a file named .valid_filename_on_Windows on Windows
  2. Move the file to a Mac OS X machine
  3. The file will not be visible via the Finder
    (File and folder names beginning with a dot mean the file or folder is hidden)

Example 2

  1. Create a file named valid_filename_on_Mac/ on Mac OS X
  2. Move the file to a Windows machine
  3. If the file is viewed via Windows Explorer the file name will not appear as it did on the OS X machine

Example 3

  1. Create a file named lpt1 on Mac OS 9
  2. Move the file to a Windows machine
  3. Under Windows 2000 viewing the folder which contains the file via Explorer will result in Explorer crashing
  4. Under Windows 2003 the file name cannot be changed because the file will require inherent access permissions
Advertisements
Published in: on January 27, 2015 at 8:58 pm  Leave a Comment  

The URI to TrackBack this entry is: https://blackbeltreview.wordpress.com/2015/01/27/illegal-filename-characters-on-windows-vs-mac-os/trackback/

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: