INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: File name length  (Read 1136 times)

Von

  • Regular Member
  • World Citizen
  • ***
  • Posts: 175
  • nothing more to say...
File name length
« on: May 10, 2013, 04:21:30 pm »

Old habits die hard... I have always tried to keep file name length under 128 characters. I don't even remember exactly where I picked up that number.  ;)

I would like to use longer names if it doesn't cause any problems. Is there any point in worrying about file name length anymore? And if so, what would the recommended maximum length be?

My main focus is MC, of course, but if you have any tips for media files in other settings as well, I would like to hear them.

Logged

Von

  • Regular Member
  • World Citizen
  • ***
  • Posts: 175
  • nothing more to say...
Re: File name length
« Reply #1 on: May 10, 2013, 04:23:44 pm »

Oops, right after posting, I saw this post: http://yabb.jriver.com/interact/index.php?topic=80510.0

Is 260 the magic number?

Logged

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: File name length
« Reply #3 on: May 11, 2013, 07:53:26 am »

And this is why it gets confusing:

Quote
In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. For example, the maximum path on drive D is "D:\some 256-character path string<NUL>" where "<NUL>" represents the invisible terminating null character for the current system codepage. (The characters < > are used here for visual clarity and cannot be part of a valid path string.
So I guess that means the most you can use is 256 characters, even though the limit is 260. D:\256<NUL>

Quote
The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters. This type of path is composed of components separated by backslashes, each up to the value returned in the lpMaximumComponentLength parameter of the GetVolumeInformation function (this value is commonly 255 characters). To specify an extended-length path, use the "\\?\" prefix. For example, "\\?\D:\very long path".

Note  The maximum path of 32,767 characters is approximate, because the "\\?\" prefix may be expanded to a longer string by the system at run time, and this expansion applies to the total length.
So in certain cases, you oculd actually support considerably longer than 256 characters. (why Explorer and the rest of Windows hasn't moved beyond this yet, is beyond me)

And further on:
Quote
When using an API to create a directory, the specified path cannot be so long that you cannot append an 8.3 file name (that is, the directory name cannot exceed MAX_PATH minus 12).
So that would be... 248 characters? (or possibly 244?)


 ?


EDIT: Did a little testing. It's 244 characters - at least that's the maxmimum length name Explorer lets me use for a folder on the root of a drive.
I can't move or create any folders/files inside that directory - but I can move files with up to 11 characters in their name into it. ::)
Logged
Pages: [1]   Go Up