ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

File Names : what should be avoided

(1/6) > >>

Armando:
I've been using a lot of  "periods" (and also commas) in my file naming lately, and, reading this http://msdn2.microsoft.com/en-us/library/aa365247.aspx, this http://support.microsoft.com/kb/115827, and other stuff, I'm now wondering if that could cause problems, eventually.

So, here are my questions :

a- If one wants to use (create) long file names (to avoid elusive descriptions or complex abbréviations), what would be the characters that should be avoided at all costs to 1- allow better compatibility in the long term, 2- and to insure seamless interoperability between 3 of most popular oS (Linux, Mac OSX and... Windows)? (of course, I'm not talking about the well known < > : " * ? / \ |)

b- should I avoid using periods ?  :huh:

I'll welcome any good references too!

Thanks!

mouser:
some guidelines:
yes i would avoid using periods except to separate a file extension, as you will confuse programs that treat anything after the period as a file extension.
dont make 2 files with the same name except for differences in lowercase and uppercase -- windows will treat such files as having indistinguishable names.

Armando:
thanks mouser.

I guess I’ll be using Bulk Rename Utility tonight…

Apart from DOS apps, do some windows apps actually interpret the first period to be the extension separator?

I know that the absolute limit for the path length is 255 characters, but I wonder if you (or anybody here at DC) use another maximum “relative” upper limit for file names (to avoid known potential problems)?

Ehtyar:
It would be an extremely lazy coder making the assumption that the first period in a file name is the start of the extension. All one has to do to be sure they have the extension is count backward from the end of the filename instead of forward from the start. Of course that makes the assumption that there is an extension at all, so it's best to have the length of the filename to count down to, and inform the user if any file they selected is missing an extension where one is required.
The laziness is even more stark given the Path* api, in particular PathFindExtension which do all path related work for you.

Ehtyar.

Eóin:
Het Armando, this link is worth glancing through. It is referring to working with highly portable paths so is actually quite a limited subset of what, say, Windows supports. Then it is probably not a bad idea to develop good portable habits should you switch OS at some later stage. I know I haven't been following these guidelines, but think I will try and start from here on :). I'll repeat the recommendations below but the link also gives the rational behind them.


* Limit file and directory names to the characters A-Z, a-z, 0-9, period, hyphen, and underscore.
* Do not use a period or hyphen as the first character of a name. Do not use period as the last character of a name.
* Do not use periods in directory names.
* Do not use more that one period in a file name, and limit the portion after the period to three characters.
* Do not assume names are case sensitive. For example, do not expected a directory to be able to hold separate elements named "Foo" and "foo".
* Do not assume names are case insensitive.  For example, do not expect a file created with the name of "Foo" to be opened successfully with the name of "foo".
* Don't use hyphens in names.
* Limit the length of the string returned by path::string() to 255 characters.  Note that ISO 9660 has an explicit directory tree depth limit of 8, although this depth limit is removed by the Juliet extensions.
* Limit the length of any one name in a path.  Pick the specific limit according to the operating systems and or file systems you wish portability to:

* Not a concern::  POSIX, Windows, MAC OS X.
* 31 characters: Classic Mac OS
* 8 characters + period + 3 characters: ISO 9660 level 1
* 32 characters: ISO 9660 level 2 and 3
* 128 characters (64 if Unicode): ISO 9660 with Juliet extensions

Navigation

[0] Message Index

[#] Next page

Go to full version