Unable to copy long Paths from one windows server to another windows server

Dokuparthi krishna sesha sai 0 Reputation points
2025-06-15T04:02:39.46+00:00

I am unable to copy long file paths from one Windows Server to another. I tried using the robocopy command but some files were still skipped. Could you please help me copy long paths without missing any files?

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 49,715 Reputation points MVP Volunteer Moderator
    2025-06-15T11:32:09.0966667+00:00

    Yep - long file paths (over 260 characters) can cause issues on Windows. However robocopy does provide long path support if you configure it appropriately:

    Start by enabling long path support on both servers

    1. Open Group Policy Editor (gpedit.msc)
    2. Go to:
         Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem
      
    3. Enable: "Enable Win32 long paths"
    4. Reboot the system.

    Alternatively, you can modify the registry directly

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
    "LongPathsEnabled"=dword:00000001
    

    Next, run this command in Command Prompt (as Administrator):

    robocopy "\\source\path" "\\destination\path" /E /COPYALL /R:3 /W:5 /LOG:copylog.txt /NFL /NDL /NP
    

    Flag explanation:

    • /E: Copy subdirectories including empty ones.
    • /COPYALL: Copy all file info (including timestamps and permissions).
    • /R:3: Retry 3 times on failure.
    • /W:5: Wait 5 seconds between retries.
    • /LOG: Output log file to track skipped files.
    • /NFL /NDL: Suppress file and directory listings in the log (optional).
    • /NP: No progress shown.

    Use UNC Paths to Avoid Path Length Limits

    Always use UNC paths (with \\?\) to bypass the 260-character limit:

    robocopy "\\?\C:\Very\Long\Path\To\Source" "\\?\D:\Very\Long\Path\To\Destination" /E /COPYALL /R:3 /W:5 /LOG:copylog.txt
    

    If this doesn't work out, here are a few alternatives:

    • GS RichCopy 360 (commercial)
    • FastCopy (free)
    • PowerShell Script with Get-ChildItem and Copy-Item (with -LiteralPath and long path support)

    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.