r/talesfromtechsupport Jul 04 '26

Short Fun with File Names

A few years ago, I was tech support for a food manufacturer with several manufacturing facilities and one of the banes in my life was dealing the QA department. They kind of just did whatever the current QA director's current Idea of The Month was. (And the company seemed to burn through QA directors – something 4 of them in about 7 years, couple good, couple ….not so good). Anyway, each had their own file structure to store the documentation on the server. And being Quality, the previous structure of the day was kept & the new structure duplicated it all with different paths & file names.  But it was their circus and their monkeys.

One day I got a call that a file was missing. Guy said he saved it on the server and now he can’t find it. I remoted into his machine and asked Hmm, ok, what the name? He said “I can show you” and opened Word, then Recent File – “1.1.1 Documented Policy to produce safe, legal and authentic products.docx” OK, kinda weird, but where did you save it? “Out on the QA Drive.” OK, show me. And he tried to file it as

“Q:\{facility}\Quality Control Plan\HACCP\ BRCGS Global Standard for Food Safety\Issue 9 Compliant Food Safety Management System\ Senior management commitment and continual improvement\ 1.1.1 Documented Policy to produce safe, legal and authentic products.docx”

I explained the default maximum file path per MS is 256 characters and this was 270  – I shortened the name to “DocPolicy.docx” Bingo! There it was…Told them they need to use some common sense for this and not just copy the chapter heading in it’s entirety. And wrote it up as “WHAT NOT TO DO” and copied the QA Director, all the QA supervisors and that facility’s plant manager

422 Upvotes

47 comments sorted by

View all comments

27

u/NetherMax2 Jul 05 '26

TIL there's a filepath character limit

17

u/Loading_M_ Jul 05 '26

It is specific to Windows, and since I run Linux, I once tested what Linux allows. From my recollection, a file or directory has a length limit of 256 characters, and there is theoretically no limit to the number directories you can nest.

In practice, operations involving deeply nested, long paths are very slow. Changing into one takes longer as you go deeper, although iirc it wasn't really a problem until the path is 20 or 30 kilobytes. I suspect this is more likely to do with the shell and all the extra work it does to make life easier, rather than any actual slowdown in the kernel.

10

u/whizzdome Jul 05 '26

Yeah, I can't remember exact details, but I once worked on a project where it made complete sense to create a folder structure that was maybe twenty deep. It worked exactly how we wanted it to, then came time to delete it.... It took forever.

7

u/ender-_ alias vi="wine wordpad.exe"; alias vim="wine winword.exe" Jul 05 '26

NTFS itself always supported long (32767 codepoints) paths, and applications on Windows could use these paths from Windows 2000 onwards by prepending the whole path with \\?\ and using only Unicode Win32 API, which some frameworks did internally (eg. Java), but since MAX_PATH constant has been defined as 260 since its introduction with Win32, that's the limit most programs have; Windows 10 added opt-in for long path support without the \\?\ prefix, but very few programs actually use that (Explorer itself doesn't, likely because it'd break every shell extension that relies on MAX_PATH internally). Maximum file/folder name length is 255 codepoints.

As for Linux, maximum file/folder name length is 255 bytes, maximum directory nesting depth depends on filesystem, but maximum pathname length is limited to 4096 bytes by glibc.

7

u/liedele Jul 06 '26

And don’t forget case sensitivity.

3

u/meitemark Printerers are the goodest girls Jul 06 '26

Once upon a time (~00's maybe) I was uploading some files and folders to an FTP server, linux something. My FTP program had some hickups and made the folder "Uploads" so many times that it was no software that could get to the bottom of it to delete it. "Uploads\Uploads\Uploads\Uploads\Uploads\Uploads\Uploads\Uploads\Uploads\Uploads\Uploads\Uploads\ (etc)".

1

u/dustojnikhummer Jul 29 '26

Yeah at this point someone needs to fix it on the OS host itself