Windows File Explorer 260 Character Limit



  • I recently had a client move to Sharepoint and ran into a snag. Of course they have many many embedded folders and are running into the issue of the file path being too long. The client is accessing data via OneDrive on their desktops. I know Windows 10 added the LongPaths option where you can increase to 400 characters instead of 260. It is my understanding that not all applications support this increase. Is File Explorer one of those programs?

    I have already enabled LongPaths in the registry as well as in Group Policy Win32 Enable Long Paths.

    Thanks



  • Where did you see that Microsoft changed the max path character limit from 260 (255 really) to 400?



  • Also worth asking/mentioning if you can would reducing the length of these file paths break anything major? I have a powershell script that makes this trivial in the sense that it can remove numerous repeated characters and replace them with a single hyphen or space mark. (really anything you wanted)



  • @DustinB3403 said in Windows File Explorer 260 Character Limit:

    Where did you see that Microsoft changed the max path character limit from 260 (255 really) to 400?

    Sorry not an official link but near the bottom - https://helpdeskgeek.com/how-to/how-to-fix-filename-is-too-long-issue-in-windows/



  • @DustinB3403 said in Windows File Explorer 260 Character Limit:

    Also worth asking/mentioning if you can would reducing the length of these file paths break anything major? I have a powershell script that makes this trivial in the sense that it can remove numerous repeated characters and replace them with a single hyphen or space mark. (really anything you wanted)

    Construction client - so they like to have folders setup "Complete Projects\JobName\Change Orders\VendorType\Some long file name.xlxs"

    Part of the issue is that when the data was hosted on their server the shares were mapped so the paths were shorter. With OneDrive the full path shows up as "C:\users\username\Sharepoint CompanyName - Documents Directory...."

    That's a long path by itself.



  • @syko24 said in Windows File Explorer 260 Character Limit:

    @DustinB3403 said in Windows File Explorer 260 Character Limit:

    Where did you see that Microsoft changed the max path character limit from 260 (255 really) to 400?

    Sorry not an official link but near the bottom - https://helpdeskgeek.com/how-to/how-to-fix-filename-is-too-long-issue-in-windows/

    Gotcha, yeah that isn't actually a resolution in my mind. One because there are always going to be issues down the road attempting to access Sharepoint with a file path of <255 characters and secondly you're going to end up with all sorts of performance issues from Sharepoint.

    I think fixing the path lengths would make more sense, rather than editing the system registry on each client.



  • @DustinB3403 said in Windows File Explorer 260 Character Limit:

    @syko24 said in Windows File Explorer 260 Character Limit:

    @DustinB3403 said in Windows File Explorer 260 Character Limit:

    Where did you see that Microsoft changed the max path character limit from 260 (255 really) to 400?

    Sorry not an official link but near the bottom - https://helpdeskgeek.com/how-to/how-to-fix-filename-is-too-long-issue-in-windows/

    Gotcha, yeah that isn't actually a resolution in my mind. One because there are always going to be issues down the road attempting to access Sharepoint with a file path of <255 characters and secondly you're going to end up with all sorts of performance issues from Sharepoint.

    I think fixing the path lengths would make more sense, rather than editing the system registry on each client.

    I agree but again lots of data and lots of renaming to something that still makes sense to them. Plus you always get the "Well we didn't have a problem on the old system".



  • @syko24 said in Windows File Explorer 260 Character Limit:

    I agree but again lots of data and lots of renaming to something that still makes sense to them. Plus you always get the "Well we didn't have a problem on the old system".

    But you would simply respond with the old system worked because it was old, this new system doesn't work because it's new and the way forward. So we need to change the process a bit.

    As for the renaming, it's a rather automatic setup. I'll grab it and post it so you can see it.



  • @DustinB3403 said in Windows File Explorer 260 Character Limit:

    @syko24 said in Windows File Explorer 260 Character Limit:

    I agree but again lots of data and lots of renaming to something that still makes sense to them. Plus you always get the "Well we didn't have a problem on the old system".

    But you would simply respond with the old system worked because it was old, this new system doesn't work because it's new and the way forward. So we need to change the process a bit.

    As for the renaming, it's a rather automatic setup. I'll grab it and post it so you can see it.

    Cool I appreciate it!!



  • So here is the script that I use, I use it to remove stupid characters from file and folder names, which also reduces the number of characters in the total path.

    # Finds special characters in file and folder paths and replaces them with an null-space '' or hyphen (where it makes sense) and allows for quick find and replace functionality that would otherwise mess up a backup sync
    # All errors are reported at the end of the run, making it easier to find something that needs attention (scroll hell) - should only print *true* errors and not " Source and destination must be different." a ~million~ times
    # Use against a specific folder IE _Archive of some directory rather than an entire share for speediness otherwise target a drive letter D:\
    
    (Get-ChildItem -Path "F:\Complete Projects" -Recurse | Rename-Item -NewName {$_.Name -replace '•','' -replace '®','' -replace '™','' -replace '','' -replace '','' -replace '~','' -replace '$','' -replace '','' -replace '','' -replace '','' -replace '/','' -replace '|','-'} -ErrorAction SilentlyContinue -ErrorVariable daError)
    if ($daError.Exception.Message -match " Source and destination path must be different.") {
    	Write-Output "ERROR - There was an error. Pay Attention : [$daError]"
    	}


  • If this client has something like -----Client 1\Change Orders\ for a path you would simple add a -replace '-----','-' which would remove all of the extra hyphens which aren't actually being beneficial in anyway to the process.


Log in to reply