20

I'm trying to properly name MP3s and I hit some arbitrary length of 129 characters (not 128?). NTFS supports 255 characters in file names, how do I fix this?

Star Wars - 6 - Return of the Jedi - 2 - 07 - Battle of Endor 2, Leia Is Wounded, The Duel Begins, Overtaking Bunker, Dark Si.mp3

John
  • 2,316

4 Answers4

37

In Windows the default total path length must not exceed 260 characters (drive + :\ + 255 characters of filename + null terminator + probably for final \ in case the path is a directory or simply for even rounding). It was a relic from DOS's 8.3-name era where a 260-character path is a really deep path.

It's possible that your path to the folder was already very long, so the remaining part for your filename is just 129. If you want longer path, you have several solutions:

Since Windows 10 there's another option by removing MAX_PATH limitation§. You can enable it by setting HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled in registry or set Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths in group policy

Note that folders have a different limit. If you make a new folder in PowerShell or .NET that has very long name you'll get the below error

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

That's because it "allows for 248 characters for the path plus the filename which allows for 12 characters."

MAX_PATH, which limits file paths to a paltry 259 characters (sans the terminating null); the current directory to 258 characters (sans a trailing backslash and null); and the path of a new directory to 247 characters (subtract 12 from 259 to leave space for an 8.3 filename).

The maximum length of the path of a file: 259 or 258 characters?


Read more:

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.

§Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.

phuclv
  • 30,396
  • 15
  • 136
  • 260
12

It is possible that you are exceeding a total of 260 characters for the entire pathname, including the backslash characters.

How many characters are in the path, including the name of the mp3 file?

Edd
  • 409
  • 1
  • 5
  • 12
0

If you need to copy the files with long paths. robocopy does a great job.

-1

Windows 7 will allow you to save filenames longer than 256 characters including path names and they can be accessed easily as well. The only small difficulty you may run into is when you copy them from one place to another, but you will be presented with a popup that asks you if you want to change the filename, not copy the file, or save it as is. I always save it as is and I've never had any problems. I've probably got a couple of hundred filenames that exceed the limit.

Gruff
  • 11