6

How can you copy/move a folder or file with path name length > 255 on windows?

I have looked around for ages, and the only possible way I have found is to use the subst method. I wish I didn't have to mess about with this. I simply want to copy/move a file or directory, X, to location Y.

I'm fine with making a .bat script, or other kinds of scripts to achieve this.


PS: this is marked as of topic, which I'm fine with, but it was being done in a programming context.

Community
  • 1
  • 1
Automatico
  • 12,420
  • 9
  • 82
  • 110
  • I just want to note also that I have checked out all of these answers, none of which works: http://stackoverflow.com/questions/5188527/how-to-deal-with-files-with-a-name-longer-than-259-characters http://stackoverflow.com/questions/1065993/has-windows-7-fixed-the-255-character-file-path-limit http://answers.microsoft.com/en-us/windows/forum/windows_7-files/how-to-find-files-whose-path-names-are-too-long-to/4f905800-2cb5-46ae-80be-99e39c01e854 (more to come) – Automatico Apr 25 '15 at 13:39

2 Answers2

21

I finally found a good solution!

The savior is

Robocopy

Robocopy supports path names > 256 by default, and even provides a flag that lets you turn OFF support for long path names (flag: /256).

Example usage of Robocopy:

robocopy /E C:/path/with/very/long/names/in/it C:/new/path

Community
  • 1
  • 1
Automatico
  • 12,420
  • 9
  • 82
  • 110
1

Not Windows 8 but in Windows 7, 64bit, I have the same problem and I just discovered that while nothing else worked, I was able to cut and paste folders containing files with path names that were too long into a destination folder with a shorter path. That is, in Explorer.exe, I selected a directory that I couldn't delete because some files had path names that were too long, then CTRL-X to cut it and paste it into another explorer window (CTRL-V).

Ian
  • 2,078
  • 2
  • 19
  • 19