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
- Open Group Policy Editor (
gpedit.msc
) - Go to:
Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem
- Enable: "Enable Win32 long paths"
- 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
andCopy-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