Long Path not working and I am unable to rename the files due to it being a shared work Dropbox

scgleeson 0 Reputation points
2023-11-22T23:02:13.8766667+00:00

Hi team, the Microsoft Community team directed me here, hope you can help!

I am running Windows 11 Pro, 22621.2715. I cannot access files with long paths on a shared Dropbox which is synced to Windows using the Dropbox app.

I am not able to rename, or shorten the access paths. This is a large, structured Dropbox account that is administered by another user, and the other users in the company use Macbooks and don't have the same result. I just need to be able to access the files in their various locations, without trying to modify them or their folder structure.

I have tried all of the below steps in italic. On my previous computer (Windows 10), the below steps worked. Since upgrading to a Windows 11 computer, I cannot get the same result.

How can I eliminate this problem permanently?

"

*Check if your version of Windows 10 supports long path names. Long path names were added in Windows 10 version 1607 and later. You can check your version of Windows 10 by going to Settings > System > About.

Check if long path names are enabled in the registry. You can do this by opening the Registry Editor (regedit.exe) and navigating to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem. Look for the value "LongPathsEnabled" and make sure it is set to 1.

Check if the group policy setting is configured to enable long path names. Open the Group Policy Editor (gpedit.msc) and navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem. Look for the "Enable Win32 long paths" policy and make sure it is set to "Enabled".

Restart your computer after making any changes to the registry or group policy settings.*

"

Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,889 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 33,951 Reputation points Microsoft Vendor
    2023-11-23T05:16:34.9566667+00:00

    Hi,

    Please prepend the "\?" and "\?\UNC" prefix to the full path and see if it works.

    https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. MotoX80 32,721 Reputation points
    2023-11-28T19:52:57.4766667+00:00

    This would appear to be an Excel bug, since your image shows that you can successfully see the folder using the explorer.

    https://answers.microsoft.com/en-us/msoffice/forum/all/excel-365-cannot-open-the-file-because-the-file/c3394950-4aa3-433a-bbe4-cdb0c02a32bc

    You have this tagged with only "Windows 11". I would recommend that you add the tags for Office/Excel to reach users who are more familiar with those technologies.

    One thought that I had would be use the 8.3 name when opening the file. I was unable to find a simple way to do that so I put together this Powershell script to build it.

    # https://stackoverflow.com/questions/16995359/get-childitem-equivalent-of-dir-x
    # https://devblogs.microsoft.com/scripting/use-powershell-to-display-short-file-and-folder-names/
    # 8.3 https://michlstechblog.info/blog/windows-enable-generation-of-8-3-names/
    
    Param([string] $path ="") 
    
    $MethodDefinition = @'
    [DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "GetShortPathNameW", SetLastError = true)]
    public static extern int GetShortPathName(string pathName, System.Text.StringBuilder shortName, int cbShortName);
    '@
    
    $Kernel32 = Add-Type -MemberDefinition $MethodDefinition -Name 'Kernel32' -Namespace 'Win32' -PassThru
    $shortPath = New-Object System.Text.StringBuilder(500)
     
    if ($path -eq "") {
        $path = read-host "Paste in the path name..."  #'c:\Program Files\common files\DynamicAppDownloader\downloads'
    }
    if ($path -eq "") {
        "Path cannot be null."
        Start-Sleep -Seconds 5
        return
    }
    
    "Path is $path."
    if ((test-path $path) -eq $false) {
        "Path not found."
        Start-Sleep -Seconds 5
        return
    }
    
    $retVal = $Kernel32::GetShortPathName($path, $shortPath, $shortPath.Capacity)
    $short = $shortPath.ToString()
    
    "Short name is $short"
    "...and has been copied to the clipboard."
    $short  | Set-Clipboard 
    if (((Get-Process -id $pid).StartTime) -gt ((Get-Date).AddSeconds(-10)) ) {  
        Read-Host "Press enter to exit."
    }
    

    Edit: I found a better way to code the script.

    It will convert a name like "C:\Program Files\Common Files\DynamicAppDownloader\Downloads" to it's 8.3 name, "C:\PROGRA~1\COMMON~1\DYNAMI~1\DOWNLO~1". As long as your file system is saving the 8.3 names, that is.

    Save that as a .ps1 file. Using the Windows explorer, copy the full path to the clipboard. Run the script and paste in the name when prompted. It will save the short name into the clipboard.

    Then launch Excel and do the file/open dialog. Paste in the short (8.3) path and see if it will open. (I don't have Excel.)

    Another option would be to create a symbolic link that points to some folder that is way down the list of subfolders.

    Here I created a link named Finance to point to some other folder.

    C:\Temp>mklink /d Finance "C:\Program Files\Common Files\DynamicAppDownloader\"
    symbolic link created for Finance <<===>> C:\Program Files\Common Files\DynamicAppDownloader\
    
    C:\Temp>cd Finance
    
    C:\Temp\Finance>dir
     Volume in drive C is OS
     Volume Serial Number is 36C0-6121
    
     Directory of C:\Temp\Finance
    
    01/20/2022  09:03 PM    <DIR>          .
    11/03/2023  10:53 AM    <DIR>          ..
    01/20/2022  09:03 PM    <DIR>          Downloads
                   0 File(s)              0 bytes
                   3 Dir(s)  503,619,686,400 bytes free
    
    C:\Temp\Finance>
    

    I don't know if that would interfere with Dropbox or not. You could create a folder, say C:\DBData, and then use mklink to create links to subfolders where the normal path is too long, by using DBData that lets it have a shorter name.

    0 comments No comments