
Windows Server File Migration: Fix Long-Path Errors with Robocopy
Technical review: 26 October 2026. Product names, licensing references and procedures reflect this review; check the linked documentation for your release.
A file copy can fail with a path-length warning even when the destination drive letter has the same length as the source. The limiting factor can be the copy tool or API, rather than the number of characters added by the move. A successful migration needs a capable tool, deliberate metadata choices and a separate cutover check.
Separate path length from permissions
Record an example failing path and the exact error. Check whether the source can be opened with another approved tool and whether the destination supports the required names and permissions. Windows long-path policy is not a universal repair: applications must use compatible APIs and, where required, opt in. Existing processes can also cache policy behavior.
Robocopy normally supports long paths; its /256 switch disables that support. Do not add that switch to a long-path migration. Avoid combining this issue with unrelated changes to ownership, inheritance or antivirus exclusions, because doing so makes the result harder to explain.
Preview a bounded directory copy
Start with one representative directory, not the entire disk root. Create the log directory first. This preview lists intended operations without copying or deleting data:
robocopy "D:\Data" "E:\Data" /E /COPY:DATS /DCOPY:DAT /XJ /R:2 /W:5 /L /LOG:C:\MigrationLogs\preview.log
Here, /E includes subdirectories, /COPY:DATS requests data, attributes, timestamps and NTFS security, and /XJ excludes junction points. Owner and auditing information need a separate decision and sufficient privileges. Junction exclusion also means some linked content will not migrate; inventory it instead of assuming the copy covers everything.
Copy first; delete nothing
After reviewing the preview and backup, remove /L and use a different log filename for the real copy. This example does not use /MIR, /PURGE, /MOV or /MOVE. A first migration pass should not silently delete destination files or remove the source. Set retry limits so a locked file does not occupy the maintenance window indefinitely.
Robocopy exit codes are a bitmask. A result below 8 can still describe differences or extra files; it is not a substitute for reading the summary. Results of 8 or higher indicate at least one failure. Capture the result immediately, before another command changes the process exit code.
Verify before changing drive letters or shares
- Review failed/skipped files and compare directory counts, sizes and representative hashes.
- Test effective permissions with an ordinary application user, including denied access where expected.
- Quiesce applications for a final pass or use an application-supported consistent-copy method; an ordinary file copy is not a database backup.
- Record share definitions, scheduled tasks, services and hard-coded paths before cutover.
Keep the original volume and an independent backup until the acceptance period ends. If the source drive also contains a paging file, handle that dependency separately using the page-file relocation checklist. Reversibility comes from preserving the original data and knowing exactly which application settings changed.