How to prevent users from exceeding the long file path name limit


Our terminal server users are constantly naming files with names that exceed the long file path name limit which then prevents users from accessing or moving the file. We are currently only able to react to the issue after the naming has taken place, are there any proactive solutions that prevents or warns users when they attempt to name a file which will then exceed the long file path name limit.

Has anyone created any Powershell scripts which have resolved the above issue?
Server GuyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexProject Systems EngineerCommented:
So, you're talking about the 255 character limit right... User education is all you have.

You could run a script which goes through and promptly renames any files hitting the limit but this carries an inherent risk.

Long and the short, there isn't really anything out there. You could consider mapping network drives to a deeper level which would stop this happening, then you could end up with issues on the server instead the client. But even then backup applications will still read it.

If it were me, I'd be properly harsh and give users 2 weeks to stop doing it, at which point any issues would be unsupported. I had to implement that rule previously and it actually worked.

When people stopped asking, I ran a robocopy for them to a shared drive to take their stuff back out and then store it appropriately. No more issues :-)



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
There's no solution for that, sorry. The real NTFS limit is way higher, otherwise users obviously wouldn't be able to store "too long" files in the first place (namely around 32000 characters, which is more than the average user is willing to type or even browse to).
The problem is "what actually is the file path length"? Well, "it depends" - again, otherwise users wouldn't be able to save files that other users won't be able to access.
There's the absolute file path on the server - that is usually already longer than what the user sees.
Then with access over shares, the path length to the same file will vary, depending on where the drive letter is mapped, or whether a UNC was used.
You'll need to educate your users, until Microsoft and all other developers will fix all their products.
Server GuyAuthor Commented:
Thanks for you above comments, I will continue to investigate.
Server GuyAuthor Commented:
Will continue researching whilst educating our users.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.