# Solved: Right command for Robocopy.



## dbguru16 (Apr 20, 2005)

Hi,
I've been wanting to transfer my files from an old HDD to a new one exactly as they are, with the time stamps the way they are currently on the old HDD and all, and I heard that using Robocopy via the command prompt can help me do that. However, I don't want to delete everything on the old HDD. I've been looking around the internet, and anything I can find is just confusing to me.

The old external HDD that has all my files and folders is J: and the HDD I want to transfer them to which is a new internal HDD is Z:

What would be the proper command for copying everything on J: exactly as it is to Z: ? I hope I put this question in the correct section, lol, and as always, thanks for everyones help.
- Guru
- Windows 7 Home Premium 64x, 16gb ram, 4.20GHz AMD FX quad-core cpu,


----------



## mhd1360 (May 28, 2012)

You can use this command
It will copy All files and folders with theirs attributes and timestamps from J: to Z:

```
robocopy [COLOR=Red]J:[/COLOR] [COLOR=Blue]Z:[/COLOR] /dcopy:T /copy:DATSOU /E
```
Details :

if you want you can make a directory on drive Z named "OldDriveFiles" and then copy whole data from J to that :

```
md [COLOR=Blue]z:\olddrivefiles[/COLOR]
robocopy [COLOR=Red]J:[/COLOR] [COLOR=Blue]Z:\olddrivefiles[/COLOR] /dcopy:T /copy:DATSOU /E
```
/DCOPY:T ==> COPY Directory Timestamps.

/copy DATSOU ==>D=Data, A=Attributes, T=Timestamps S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

/E ==> copy subdirectories, including Empty ones.

You can remove which one of "DATSOU" if you want.


----------



## dbguru16 (Apr 20, 2005)

AWESOME! You told me exactly what I needed to know and what it meant, appreciate it so much.  I get how it works now and will definitely be giving it a try as soon as I get home from work. Thanks a bunch. =D


----------



## mhd1360 (May 28, 2012)

Your welcome dude


----------



## dbguru16 (Apr 20, 2005)

Is it ok to not use the /copy: DATSOU ? I got the error that I don't have the Manage Auditing user right and that I need that to copy auditing information (I dunno what auditing information is anyway, lol. Is it important?).


----------



## mhd1360 (May 28, 2012)

Yes, You can ignore "U" and use /copy: DATSO


----------



## bbearren (Jul 14, 2006)

I would use

J:\ Z:\ /E /COPYALL /XJ

/E copies folders recursively, including empty folders. /COPYALL copies all file information/attributes. /XJ excludes Junction points.


----------



## dbguru16 (Apr 20, 2005)

That's so confusing, lol. What do you mean by recursively and what are Junction points? (Isn't very pro or leet at this stuff, lol.) Just got home and just finished running anti-virus on the hdd, so I'm ready to go.


----------



## mhd1360 (May 28, 2012)

/COPYALL <=> /copy: DATSOU


----------



## dbguru16 (Apr 20, 2005)

Ah, ok. Thanks.


----------



## mhd1360 (May 28, 2012)

Both commands will work
No Problem


----------



## dbguru16 (Apr 20, 2005)

It seems the only thing I can get copied is a .avi file that is not in a folder in J:
After that all I get is :

2012/06/26 22:56:28 ERROR 5 <0x00000005> Accessing Destination Directory Z:\$RECYCLE.BIN\
Access is denied.
Waiting 30 seconds...

That repeats... Not sure why, there's not a recycle bin on either drive, their just storage drives, lol.
Also, still get the ERROR about not having the Manage Auditing user right with the second way of copying everything that bbearren suggested.


----------



## bbearren (Jul 14, 2006)

Are you using an elevated command prompt? And there is a Recycle bin on every drive, even if you have designated no Recycle bin for the drive. Windows puts an empty Recycle bin there regardless.


----------



## dbguru16 (Apr 20, 2005)

I'm using the Command Prompt under Start>All Programs>Accessories. Is there a different one in Windows I should be using for this task?


----------



## Megabite (Apr 5, 2008)

No, just right click on the command Prompt Icon and "Run as Admin"


----------



## dbguru16 (Apr 20, 2005)

*Sigh* Ok, all's good now (Run as Admin solved all that stuff from before ^_^), except, there's one folder I never understood how got created, and can't seem to disable it from being read-only and switch its ownership over to me. It's a random folder on J: named e97f86013c7b52b5730d and it's locked. Has subfolders with names like 1025, 1036, 2070, and several other four digit named ones. What looks to be an installer named NDP20SP2-KB974417 and HotFixInstaller. Just looked it up and seems these are Windows files, dunno why their on my external hdd. Anyway, is it OK to delete this folder and how since it's locked (seems like I should be able to no prob right now, but just askin' before I do, lol)? Or is there another suffix I can add to the robocopy command that will skip over the folder "e97f86013c7b52b5730d" completely and move on? Because once it fails to copy this folder, it just gets stuck and continues to retry over and over. Thanks again for your help.


----------



## dbguru16 (Apr 20, 2005)

No takers? lol


----------



## bbearren (Jul 14, 2006)

Which switches did you use with Robocopy?


----------



## dbguru16 (Apr 20, 2005)

robocopy J: Z: /dcopy:T /copyATSOU /E
is there a way to disable smileys so that shows up right? lol


----------



## bbearren (Jul 14, 2006)

Re-read post #7. Those are the only switches you need when Robocopy is run from an elevated (right-click and select "Run as administrator") command prompt.


----------



## dbguru16 (Apr 20, 2005)

Well yeah, what I'm sayin' is that I did that and that particular folder wont copy because it's locked and not sure how to unlock or if it's even of any importance for that HDD. But it's all good now. It just occurred to me that maybe I could (and just did... no idea why that worked, lol) add a bunch of X's to the start of that folder to make it the last thing copied, so when it gets stuck unable to copy that folder, I can just stop the robocopy and be finished, lol.


----------



## dbguru16 (Apr 20, 2005)

Ok, looks like it got stuck on something else, but so I got pretty much everything I wanted transferred anyway. I just need one folder moved over and it seems " robocopy J:/x-OAKDDrive-x Z: /dcopy:T /copyATSOU /E " didn't exactly do what I wanted, lol. So what command do I use to copy the specific folder (x-OAKDDrive-x) from J: to Z:

The command I just tried just pours the contents of the folder into Z: Perhaps I just need to manually make that folder and try " robocopy J:/x-OAKDDrive-x Z: /dcopy:T /copyATSOU /E "? Seems there'd be a short easier way.


----------



## bbearren (Jul 14, 2006)

"robocopy J: Z: /dcopy:T /copyATSOU /E" is not the same as
"robocopy j:\ z:\ /e /copyall /xj".



dbguru16 said:


> Ok, looks like it got stuck on something else, but so I got pretty much everything I wanted transferred anyway. I just need one folder moved over and it seems " robocopy J:/x-OAKDDrive-x Z: /dcopy:T /copyATSOU /E " didn't exactly do what I wanted, lol. So what command do I use to copy the specific folder (x-OAKDDrive-x) from J: to Z:
> 
> The command I just tried just pours the contents of the folder into Z: Perhaps I just need to manually make that folder and try " robocopy J:/x-OAKDDrive-x Z: /dcopy:T /copyATSOU /E "? Seems there'd be a short easier way.


I'm giving you the switches to use, and you say that's what you're doing, but then when you show the command line you're using, you're *not* using the switches I gave you that you say you're using.

I can't seem to help you, as you're ignoring the advice I'm giving.

So here's the last time. To copy the folder "x-OAKDDRIVE-x" from J: drive to Z: drive, use ROBOCOPY J:\x-OAKDDRIVE-x Z:\x-OAKDDRIVE-x /E /COPYALL / XJ


----------



## dbguru16 (Apr 20, 2005)

My bad, I got the post users mixed up. Lots of multitasking lol. And when I said I did try that, even though I posted that I used the other robocopy command, what I meant is that I tried BOTH ways, and both the commands that you posted and mhd1360 posted presented the exact same problems (well, that's when I attempted to copy the entire HDD at the time, and thought we were still talking about that while avoiding how to copying the specific folder, lol). I appreciate the help and apologies for the frustrations, I got a bit confused in the jumble. In any case, that last command for the OAK folder did work, much thanks. Got a few beeps during the process, not quite sure what that's all about, but at least it got copied. ^_^


----------

