1

I sometimes found that when using simple right-click and copy-and-paste, some files/directories are not copied completely or not at all, because of various reasons, such as some saved webpage files/directories have some strange characters in their names or their names are too long.

For example, in Windows 7, I save this webpage http://www.howtogeek.com/howto/windows-vista/working-around-windows-vistas-shrink-volume-inadequacy-problems/ completely in a very deep directories whose parent directories may have long names, I cannot copy its top ancestry directory, as Windows complains the filename for the saved webpage directory is too long.

In Ubuntu, sometimes I can save a file with some special character such as newline under some directory. But when I copy that directory, it will say the file name has some special character and I will have to manually remove the character.

Such cases are complained in both Windows and Ubuntu. I was wondering what some better ways to accomplish the copy job in both Windows and Ubuntu. For example, will archiving all to be copied into a single archive help? If yes how to do that?

2
  • ..strange characters in their names .. and names being too long.. can you elaborate on that? are you supposed to have strange chars or very long filenames? can you give some examples?
    – barlop
    Feb 11, 2011 at 14:42
  • @barlop: for example, in Windows 7, I save this webpage howtogeek.com/howto/windows-vista/… completely in a very deep directories whose parent directories may have long names, I cannot copy its top ancestry directory, as Windows complains the filename for the saved webpage directory is too long. In Ubuntu, sometimes I can save a file with some special character such as newline under some directory. But when I copy that directory, it will say the filename has some special character and I will have to manually remove it.
    – Tim
    Feb 11, 2011 at 15:23

3 Answers 3

2

I use TeraCopy to copy large groups of files as it lets me know when errors have occurred and on what files. It will also continue copying your files even if some fail so that you can go back and look at the log of failed files and figure out a fix.

2

There is a 255 char limit on file paths, with windows explorer.. I might've heard of people using norton commander to do it but not sure. Maybe other copy programs too. If teracopy can then fantastic 'cos that's a great third party copying program extremely natural to use.

You could use subst

C:>subst j: c:\v

where c:\v is to be replaced by some long parent directory. Then at least you can access the subdirectories and the whole path is shorter, you can copy stuff.

3
  • Thanks! I was wondering the 255 char limit is put on the name of a file/directory, or the path of the file/directory i.e. including the names of all ancestry directories?
    – Tim
    Feb 11, 2011 at 18:22
  • the path. a quick check.. shows it's 255 once removed backslashes you can try creating very long directory names see how far it goes. then a file at hte end and keep increasing the name of the filename. One issue is creating the file with right click "new text document.txt" can be too long.so i tried creating the file of length 1 from cmd.exe with copy con a (enter file contents then end with ctrl-z).indeed,255 char limit when backslahes removed. so the full path will be a bit over 255.can copy/paste directory names into notepad to put the full path in notepad and it sys length(col)
    – barlop
    Feb 12, 2011 at 17:22
  • i'm not eure whether that includes or excludes backslashes 'cos I got a slightly mixed result. But it is the path that has the 255 limit. Anyhow, here's a question/answer on it stackoverflow.com/questions/1065993/…
    – barlop
    Feb 12, 2011 at 17:28
0

For copying files in Windows, especially with lengthy (>255 character) filepaths, RoboCopy is the best option.

It is pre-installed on all Windows systems since NT, and will handle anything up to a dodgy network admirably.

Try:

robocopy.exe sourcedir targetdir /MIR

You can also log all output to a file, and get a summary of missed files etc, at the end. This page will help with parameters.

*quick note: Please only try /MIR if you want to mirror the directory (including removal of files not in source.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .