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
LVL 1
Thor2923Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Travis MartinezStorage EngineerCommented:
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.

Thanks,

Travis

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Travis MartinezStorage EngineerCommented:
I'll also add that the /MIR option will copy empty directories and file attributes as well.
0
NVITEnd-user supportCommented:
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
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

CompProbSolvCommented:
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....
0
NVITEnd-user supportCommented:
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?
0
Travis MartinezStorage EngineerCommented:
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.
0
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.
2
Thor2923Author Commented:
copy is still running but going beautifully ....thanks
0
yo_beeDirector of Information TechnologyCommented:
Grad to hear.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.