Post title too long (it’s way longer than 8 bytes)

We’re so many miles down the road from what was possible, even imaginable, back in the days when DOS ruled. None the less weird limitations from the olden days sometimes still surface to haunt us.

At this point in spacetime, we have passed more than midway through 2015. Standard end-user computers have a vast amount of memory, advanced multi core processors running typically at more than 2 GHz (2.000.000.000) instructions pr. second, dedicated graphical processors and solid state drives capable of storing data that would be difficult to fit into 4-5 million good sized books.

Surely old limitations don’t apply, right?

Well. Yea’ they do.

Paths longer than 260 characters (or bytes) will wreak havoc on even modern operating systems such as Windows 10, and Windows 8, and Windows 7, and … It’s even documented.

Why 260 bytes?

The drive letter part of a path is held seperately and stored as an integer number representing the drive. Normally “C:\” or “D:\” and so forth is written for better readability by us humans. That’s the first 3 bytes of a typed path. The remaining part of a file or folder path is stored in a string up to 256 bytes long. 256 seemed like a reasonable limit back when files and folders were restricted to 8 characters and 3 characters extension designations, for example; “LONGNAME.TXT”. So 256 was chosen without much debate. Finally a NUL (0x00) termination byte ends the path data. All in all this yields 3 + 256 + 1 bytes = 260 bytes as the maximum file length path an old DOS system would accept.

Then DOS evolved. Having only 8 bytes to describe files became outrageous. The use of longer file names was added. For a long time, a mix of old and new drivers, software and dark corners of the operating system did not provide full support for this though and “MYVERYLONGNAME.TXT” became “MYVERY~1.TXT”. Fun times!

But that’s gone now.

Fortunately.

The 260 limits is not.

Evolve.

Now!

Thanks.

2 thoughts on “Post title too long (it’s way longer than 8 bytes)”

  1. Just use the Unicode-enabled Windows API version: “\\?\D:\something-as-long-as\32767\characters\long.txt”

    1. That’s a great idea – please tell it to everyone. The fault in particular is due to Visual Studio 2015 and it’s native nodejs and bower/npm functionality.

Leave a Reply

Your email address will not be published. Required fields are marked *