We help IT Professionals succeed at work.

Preventing the creation of files/folders with too long path names

211 Views
1 Endorsement
Last Modified: 2020-09-18
Experts,

We often encounter situations where users create files and folders with very long names and paths.
From the user's perspective, all is fine, until we try to copy those folders. Also, if the path is extremely long, a user may create a file that they cannot open afterwards.

Yes, we can use registry hacks, Robocopy and third-party applications like SyncBackPro, but we need a more consistent solution. The long paths create problems for DFS replication, for example.

Is there a way to prevent a user from creating files and folders that would result in too long paths? Some kind of warning message to the users?

The users are connected to RDS servers (2008R2, 2012R2, 2016), accessing shared folders, so the actual path name is a bit longer than what the users see.

Thanks!
Comment
Watch Question

CERTIFIED EXPERT

Commented:
There is no technical solution to this. Just inform the users to avoid too long file-/path-names...

Author

Commented:
Not even some kind of 3rd party software?
CERTIFIED EXPERT

Commented:
Not what you originally want but maybe helpful:
http://corz.org/windows/software/accessories/Long-Path-Fixer-for-Windows.php

Server 2016 and Windows 10 1607 allow the setting of a policy to enable longer paths than 260 cars:
https://www.pelegit.co.il/enable-long-path-windows-server-2016/
But I'm afraid there are some applications that won't be able to cope with it
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
We encourage clients to make short root and sub folder names. That keeps the overall structure short. Then we caution them to use filenames as short as possible.

As stated above, there is no technical fix for this, so we encourage clients as per the above approach.

Author

Commented:
@Michael: Thanks for your suggestion, we'll try it out and let you know!

Author

Commented:
@John: If it were only that easy...
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
It is easy.  "Board of Directors" folder is BOARD.   Next subfolder  is year (2017-2018). Next folder is Month (May 2018).  Then there are the files. 20 characters of structure.

It requires users to think a bit.
CERTIFIED EXPERT

Commented:
Why not just enable Long Paths for Windows 10.  The 260 byte limit is such a horrendously obsolete limit.  NTFS has supported longer paths for years even when Windows itself continued to artificially limit the paths.  When you accessed the shares from Macs or Linux, you've always been able to put much longer paths and names.

https://mspoweruser.com/ntfs-260-character-windows-10/

Open Group Policy Editor (Press Windows Key and type gpedit.msc and hit Enter key.
Navigate to the following directory:  Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem > NTFS.
Click Enable NTFS long paths option and enable it.
Senior IT System EngineerSenior Systems Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
@Senior IT System Engineer Too long file paths create problems with DFS replication.

Author

Commented:
@serialband What are the consequences of enabling this on a terminal server with many applications installed and numerous users logged on? I've read that certain 32-bit application (most of our applications are, including Microsoft Office) may have problems.
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
@serialband If Microsoft Office are among the applications known to have issues with extended file names, then we cannot make use of that solution.
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
So you need to train people to use shorter paths. That is a workable approach that we employ.
CERTIFIED EXPERT

Commented:
I'm not sure how Microsoft Office on Windows is programmed.  If it's with some systemwide API hooks, such as with .NET, then that change may cause it to work.  If it's using some other API that's not affected by this change, then it will still have this broken path name limit.  You'd have to test it.  I haven't had to deal with this problem in some years now.

Office for Mac will have its own programming, as there is no .NET on it, so Office for Mac will remain broken.  However, Macs can work around it by mounting the disk at some lower level.  If you have Macs in the environment, you will continue to have this issue if you share out lower level folders, because there 260 byte path name limit will start from where they're mapped.

In older days, you can also work around the limit a bit by using the 8.3 names of the longer folders and files, effectively shortening longer names to 8 or 11 characters, depending on whether you have dot in the name.  You may have to turn on the 8.3 names to see what they map to.
Hi... I have a simple solution of your problem. Few day before i was facing the same problem, now i am using LongPathTool for shortening filenames and folders.

Author

Commented:
Thanks for your reply. It will not help me in this case, but it will be very useful in a different scenario for another customer.
Seth SimmonsLead Systems Administrator
CERTIFIED EXPERT

Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- serialband (https:#a42579304)
-- Senior IT System Engineer (https:#a42578901)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

seth2740
Experts-Exchange Cleanup Volunteer

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions