I have 2 folders, the first:


and the second:


I would like to merge them like so:

C:\folder2\subfolder\a.txt (folder 2's a.txt)

Description of what I want:

Is there a simple DOS command to copy all of the folders, subfolders and files from folder1 TO folder2, but if something exists in folder2 I do not want to overwrite it. If folder 1 has files that do not exist in folder2, I want them to be copied in.

Note: both folder1 and folder2 share common subfolder names.

Note 2: Folder2 is several TB's so I really have to copy into folder 2. Folder1 is only several GB.

I can't do this in windows explorer because there is no option to say overwrite files? No to all.

4 Answers 4


Yes, the robocopy.exe resource kit utility I think was made part of the OS with Windows 2003. You can specify all sorts of options as to what gets overwritten or not.

By default, robocopy won't overwrite same files, just newer versions over old - it's a folder syncing tool, mainly.

If you want to avoid any sort of overwrite, this might work,

robocopy C:\FOLDER1 C:\FOLDER2 /e /xc /xn /xo 


/e is copy all subfolders, even empty ones.
/xc is exclude changed files.
/xn is exclude newer files.
/xo is exclude older files.

I recommend you test first with these additional switches,

robocopy C:\FOLDER1 C:\FOLDER2 /e /xc /xn /xo /l /log+:robocopy.txt /np /ndl /tee


/l is just list, don't actually do anything. Remove this switch when you're happy with what robocopy will do.
/log+: appends output to a text file, so you can study it, or /log:, which overwrites the log each time.
/np prevents "% done" progress info in the log.
/ndl is a personal preference for a cleaner log output, but maybe leave this switch out until you're comfortable with how robocopy works.
/tee shows you output on the screen as well as the log.


You could use the /Y switch of XCOPY or use ROBOCOPY ("Robust File Copy for Windows" as part of the Windows Server 2003 Resource Kit Tools), which by default overwrites without asking for confimation.


Another nice option is to install rsync on the Windows machine, and you get all sorts of great functionality. DeltaCopy is one tool based on rsync: http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp


You could also just use explorer to copy the contents of folder2 to folder1 (or to a copy of folder1). In that case you can overwrite existing files in folder1 and therefore files in folder2 'win'.

Am i missing something?

  • Yes, folder2 is several TBs large and folder1 is only a few GB. Jun 7, 2009 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.