Robocopy without writing over pre copied folders or files

I need to run robocopy to copy several TB of data from my server to another. Someone before was trying to drag and drop and had timeout issues and I think he may have also had permission problems. I want to run it tonight once and for all. I do not want to write over anything that has already been copied, I need to copy all folders, subfolders and files and I am a domain admin. I want to log into my target server and run something like this:

C:\Robocopy \\server1\Folder\sourcefoler E:\folder\targetfolder /S /?  

I do not want to have to run this again, I am hoping it will skip any files that do not copy and continue until everything is done. I do not care of empty folders are copied or not. All suggestions welcome. I am asking on here because I do not want to get a switch wrong and hope it can be done once and for all tonight. Too many people have already tried to make this happen...thanks
Who is Participating?
Travis MartinezSmoke JumperCommented:
The /MIR option will not copy files that already exist and are of the same size and timestamp.  If the timestamp is different it will copy it again.

C:\Robocopy \\server1\Folder\sourcefoler E:\folder\targetfolder /MIR /R:3 /MT:8

The R is retries, default is 1,000,000 tries before timing out.  The /MT is threads.  This works well and can be adjusted.  I've had issues with too many threads causing network errors.



Open in new window

Travis MartinezSmoke JumperCommented:
I'll also add that the /MIR option will copy empty directories and file attributes as well.
It may be wise to also use these switches:
/dcopy - to copy the folder timestamps. Else, it will have the current time.
/log+:filename.txt (append to existing log) or /log:filename.txt (overwrite existing log) - logging is helpful for reviewing what happened
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Either I'm confused (certainly possible) or /MIR works differently from what is being described here.  The help screen states: "/MIR :: MIRror a directory tree (equivalent to /E plus /PURGE)".  The key here is that it removes files in the destination that don't exist in the source.

Doesn't Robocopy, by default, skip files where the source timestamp is the same or older than the destination?  I think that's what the OP wants.

I agree with the use of /R though I'd also /w:2 (only wait 2 seconds instead of the default 30 before retrying) and also agree with /dcopy and /log....
do not want to write over anything that has already been copied
In that case, don't use /mir. /S should be fine. Do you need the permissions copied also?
Travis MartinezSmoke JumperCommented:
Mirror will not purge everything automatically but yes it will remove a file in the target directory if it does not exist in the source.  Anything that exists in the target directory that has the same file size and timestamps as the source will be skipped and not copied.

It's a question about what needs to be preserved in copy.
yo_beeDirector of Information TechnologyCommented:
All above are very good examples. I do think you will need to rerun it a few times to catch all files.

Here is my normally go to switches:
robocopy "\\server1\Folder\sourcefoler"  "E:\folder\targetfolder" /S /XO /W:0 /R:0  /COPYALL /DCOPY:DAT  /log:C:\temp\logfile.txt /NP  

Open in new window

the /NP is key if you do not want a log file that balloons.  If you do not care about the files be logged and all you want to see if the final results you can use /NFL /NDL switches
robocopy "\\server1\Folder\sourcefoler"  "E:\folder\targetfolder" /S /XO /W:0 /R:0  /COPYALL /DCOPY:D  /log:C:\temp\logfile.txt /NP /NFL /NDL 

Open in new window

Then I rerun it until there are no more files that need to be copied.

Edit: /E = all sub-directories (including empty) /XO= exclude Older files.  If the file in the destination matches the source it is skipped.  
The rerun take a fraction of the time.  I had 300 GB first run take hours and the additional passes took minutes.
Thor2923Author Commented:
copy is still running but going beautifully ....thanks
yo_beeDirector of Information TechnologyCommented:
Grad to hear.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.