Maximum Path Length

#1

Does Mp3Tag have the manifest entry in the Windows version to support long path names? I currently run into issues accessing files with a total path name longer than 260 chars (only shows the file name but non of the tags) even though it’s properly enabled in Windows 10 and Windows File Explorer can correctly display all tags (but not copy/move the files since apparently Microsoft is incapable of updating the File Explorer to support NTFS long paths).

#2

No, fully qualified filenames must not be longer than 254 characters. (or is it 256?)

#3

Mp3tag uses some Win32 Shell functions that are bound to the MAX_PATH = 260 limit.

#4

@Florian is it really?

https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation

What functions do not adhere this, if it is not an secret?

#5

Thanks all. Florian, all I know is, especially for classical music I quickly surpass that limit. Of course I can work around that but I really shouldnt have to.
I assume you can only implement this once MS reworks their shell to support long paths?

#6

It's on my list to revise the handling of paths in Mp3tag. Many other functions work with long path if \\?\ is prepended to the path. I'll need to look into this.

1 Like
#7

Is that gonna be most likely a thing implemented in the next couple of days or weeks or should I work around the limitation? I'm about to move and retag a lot of files that surpass the 260 limit.

#8

A few years back I used DetlevD's max path truncation action that took into account the file extension length as a workaround. Sadly the colored text in the code boxes from the previous forum software didn't make the transition to Discourse, which makes the action nearly impossible to read (or use without a lot of formatting), though the principle is easy enough to understand.

#9

I've fixed the formatting, thanks for pointing.

You can wait till Friday where I plan to release the next Development Build. If it's getting too complex to include it there, I suggest to work around the limitation.

1 Like
#10

I've added support for long paths with the latest Development Build Mp3tag v2.88f.

It's a major change that affects many, many parts of Mp3tag. Please test thoroughly.

While it now supports paths up to 32767 character, the individual segments are limited — commonly to 255 characters. See Naming Files, Paths, and Namespaces — Maximum Path Length Limitation for details.

2 Likes
#11

Today I tagged a classical work from a websource and probably ran into the trap of a too long path.
This happened with an action "Format Value" for _FILENAME. It also happens with the converter
Tag->Filename.
(Registry key for long filenames and group policies are activated).

Because I have a german Windows I get the error:
"Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.", even when Mp3Tag is set to English.

I generally try to avoid too long filenames, because the compatibilty on other computers could not always be guaranteed.
I am only interested wether there is a restriction in handling these paths within actions and the converter. Manually renaming the files in Mp3Tag or Windows-Explorer makes no problems.

#12

It should be supported also for actions and converters, while still respecting the restrictions that apply to long paths in Windows.

Quoting Naming Files, Paths, and Namespaces (emphasis mine):

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 ".

So if you're creating a file path where one component (folder or filename) exceeds (usually) 255 characters, you'll get the error you've reported. It's coming straight from the OS, so it doesn't respect Mp3tag's language settings.

What surprises me is what you've stated above, that

Can you double-check again? Windows Explorer automatically cuts the filename IIRC.

#13

You are right. The filename itself exceeded 255 characters.

Hm. I cannot reproduce what I wrote.
But there is something odd with the explorer:
I've got a filename with the length of the complete path is 339 characters and the filename as the longest part of the path has 242 character.
I can rename the filename in MP3Tag manually. Changes here take effect at the filename in Windows explorer.
But I cannot manually rename the filename in Windows Explorer itself. Changes are irgnored.

#14

Yes, it seems that Windows Explorer is one of the infamous examples that still don’t support long paths (even if enabled via group policy or registry).

For everyone who encounters any long file path issues with Mp3tag, please again read

closed #15