We help IT Professionals succeed at work.

Backing up files with filename\path length  >256 characters in Windows 10 Home 64.

144 Views
Last Modified: 2018-10-07
I have 400GB of files to back up for safety purposes onto an external USB HD.
I started using just the copy and paste for the whole thing and, it appears, this worked OK - probably better than one should expect.
However, there were many filename/path combinations that were too long.

The files aren't "mine" and I don't have any way to judge how to change the path length.
Yet, I'd like to get the backup job completed so I can move on to the next task.

I've tried running xcopy
C:\WINDOWS\system32>xcopy "C:\office" F:\office /c /d /e /h /i /k /q /r /s /x /y
but this results in
Unable to create directory - [name]
File creation error - The system cannot find the file specified.

This is on a Windows 10 Home 64-bit workstation.

Now, I've checked and the files appear to be there even if the filename/path length is greater than 256 characters.
There are too many to manually deal with this and I'd like to back up the remaining files that were initially missed.

Once the backup is done, perhaps we will be able to shorten the path lengths.  But the backup really needs to be done first if at all possible.

I'm doing this remotely so my ability to do things with the hardware or to boot from DVDs, etc. is accordingly limited.
What would you do?
Comment
Watch Question

CERTIFIED EXPERT

Commented:
Have you tried Robocopy?
CERTIFIED EXPERT
Most Valuable Expert 2013

Commented:
What would you do?

I'd use Robocopy instead of Xcopy
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
In addition to the above, try bulk renaming intermediate folders to a shorter length. At this point in time, there is not a Microsoft solution for long filenames so it is best to shorten them somehow.
Fred MarshallPrincipal
CERTIFIED EXPERT

Author

Commented:
John:  
The files aren't "mine" and I don't have any way to judge how to change the path length.
We are working with the owners to suitably fix the length issue.

I would try Robocopy but had installed Beyond Compare to investigate the difference.  Not only did it find and display them nicely, it was able to copy them across at any level, file or directory.  But, in the future, I'll keep Robocopy in mind.  But nobody really said: "Robocopy will take care of this problem".  So, just to be sure: Will it?
JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
On a one time basis, Robocopy will get files from here to there as suggested above but the the problem persists. My suggestion above was for a longer term solution
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2013
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Fred MarshallPrincipal
CERTIFIED EXPERT

Author

Commented:
Robocopy supports 256 characters by default
If so, why was it recommended?
But, nonetheless, I do appreciate the suggestions!

Now, I have seen the regedit for LongPathsEnabled;  however, it seems that not all things respond to this setting change.  So, I'm left with wondering and asking: "Will it help in this case / with this app?"
For example, I believe it will not work with Windows Explorer.  What else?  etc.
CERTIFIED EXPERT
Most Valuable Expert 2013

Commented:
Robocopy supports LongPaths by default - not the other way around - you can limit it to 256 characters in its settings configuration if you choose to but there's normally no need.

You're right that not all Windows software supports longpaths, however since the Win 10 Anniversary Edition 64bit Windows' Kernel does and by extension 64bit Windows File Explorer. Most newer 64bit Windows Apps are longpath aware but 32bit versions are much more hit & miss.

For your backup purposes though that shouldn't be an issue.
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Fred MarshallPrincipal
CERTIFIED EXPERT

Author

Commented:
Well, let's be clear:  I see from that link that Robocopy has an option:
/256  Turns off support for very long paths (longer than 256 characters).
Now, that does NOT say:
/nnn Turns off support for very long paths (longer than nnn characters).
No.  It's very specific.  
It clearly implies that longer than 256 characters support is the default.
And that's what everyone said....  
Thanks! Sorry it took me a bit to believe what I was reading.....
Fred MarshallPrincipal
CERTIFIED EXPERT

Author

Commented:
Thanks again!!