On Windows, what is the maximum file name length considered acceptable for application output? (Updated and refined)

Many Windows applications (for example, almost all .NET applications) cannot open paths longer than 260 characters. I am renaming the list of podcast files. I want to name each file after the title of the episode, but the names are up to 100 characters long. This means that if the user saves the file in a deep directory with a very long path, he can go beyond and will not be able to open the file in these other applications.

Is it acceptable for my program to give out file names for a long time and leave it to the user to deal with very long paths when it appears? iTunes visits at 40 characters, but it seems very conservative.

Thanks to Ben Voigt for clarifying that this applies only to certain applications.

+6
source share
2 answers

On Windows, there should not be 255 characters for file paths.

CreateFileA has a limit of 260 characters. CreateFileW supports names up to 32,760 characters (64 KB).

Some file systems impose additional restrictions on the maximum level of nesting directories or the maximum length of each part.

You are probably thinking of some popular Windows programs with a 255 character limit, but placing those with a warning or a user-configurable option is probably more appropriate than adding your own hard limit .

+3
source

Well, I remember that the USB stick did not support more than 32 characters in the file name (I don’t remember which FS it has). I also found this link on Google: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

Character limits may also be different and may vary depending on the file system prefix format used and the path name. This is further complicated by the support of backward compatibility mechanisms. For example, the older MS-DOS FAT file system supports a maximum of 8 characters for the base file name and 3 characters for the extension, for a total of 12 characters, including a dot separator. This is usually called the 8.3 filename. The Windows FAT and NTFS file systems are not limited to 8.3 file names because they have long-term support for the file name, but they still support the 8.3 version of long file names.

0
source

Source: https://habr.com/ru/post/904713/


All Articles