How to prevent long file name error copying from an external drive?

19

6

I have an external hard drive with many files (800 GB). I want to copy the entire contents of the external hard drive to my local drive. get many errors about long file name or long file path. Renaming is also not possible because of number of errors.

What can I do about this issue?

SliverLight

Posted 2011-10-23T05:34:09.940

Reputation: 193

Answers

17

You'll get these kinds of errors if you use the drag-and-drop copy within Windows explorer.

However, if you use Robocopy, you should find that you can copy the files without any issues.

The command-line version of Robocopy is built-in to Windows 7 and Windows Server 2008; it can be downloaded for other operating systems. Although there is a downloadable GUI, it's best used from the command line (aka CMD.exe).

By default, Robocopy should handle paths greater than 256 characters (there's a switch to turn it off, but in your case you don't want to do this).

Example command line (which will copy all files in the folder C:\Projects to the folder Z:\Projects):

robocopy "C:\Projects" "Z:\Projects" *.* /COPY:DAT /E

misterjaytee

Posted 2011-10-23T05:34:09.940

Reputation: 1 763

Can Robocopy solve the problem at http://superuser.com/a/216718/78897 ?

– Pacerier – 2015-05-16T00:33:59.587

@Pacerier - absolutely, I use robocopy for this purpose frequently – misterjaytee – 2015-06-29T21:31:03.027

@misterjaytee, While robocopy is built-in, I've heard Terracopy is much better. Why don't you use that? – Pacerier – 2015-07-02T09:35:33.997

@Pacerier - I was answering a question based on lots of experience of using Robocopy. Main reasons for not using Teracopy are: Robocopy is built into all currently supported versions of Windows and works nicely enough for our requirements; and Teracopy is commercial software (i.e. you pay for it) - it is only free for personal use. – misterjaytee – 2015-07-25T10:19:55.920

thanks for answer / would you plz tell me which parts of robocopy should i check for this purpose! – SliverLight – 2011-10-23T10:34:44.893

those checks are so important... – SliverLight – 2011-10-23T10:37:31.803

1Edited answer to provide an example Robocopy command – misterjaytee – 2011-10-23T12:02:45.303

thanks for edit / should i use this command in command prompt(cmd) or robocopy has a place for using that command? – SliverLight – 2011-10-24T10:28:41.673

As it says in the text, "use it from the command line" otherwise known as the command prompt or CMD. – misterjaytee – 2011-10-24T18:44:10.810

thanks for comments / but in visual mode where places should i check for the best entire copy ? – SliverLight – 2011-10-26T10:36:55.677

you can downlaod it from this link -> http://technet.microsoft.com/en-us/magazine/2006.11.utilityspotlight.aspx

– SliverLight – 2011-10-26T10:38:53.943

robocopy gui only copies some files and folders just 4 a second / not all files and folders / but that cmd command works perfect. – SliverLight – 2011-10-26T11:15:40.183

Glad you got it sorted - to be honest, never used the GUI and hadn't realised that's what you were trying to use. Command line wins every time for me ;) – misterjaytee – 2011-10-26T18:37:55.577

/COPY:DAT is the default. From the documentation... /COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT). (copyflags : D=Data, A=Attributes, T=Timestamps). (S=Security=NTFS ACLs, O=Owner info, U=aUditing info). – buzz3791 – 2014-01-09T14:22:17.430

@buzz3791 - yes I know. But defaults change from time to time and it does no harm to put in the intended copyflags. – misterjaytee – 2014-01-10T07:45:40.047