Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using robocopy to copy files, but it simply hangs (I guess the reason is that the file is already present in the location). Is there an option using which I can overwrite files (if they are already in the destination) or simply copy it if it is not there?

share|improve this question

migrated from May 9 '13 at 16:00

This question came from our site for professional and enthusiast programmers.

What do you mean by hangs? Do you see an error or anything? PS look at the /mir option... – Chris Moutray May 8 '13 at 11:29
It doesnot give any error. I can't use /mir option as it would delete the files already present in the destination folder.Please suggest some other options. – gautam kumar May 8 '13 at 11:38
Try where robocopy to find the robocopy executable and make sure the one you're using matches the operating system. IIRC, the older version of robocopy that used to be distributed with the resource kit is not fully compatible with later operating systems and that might be manifesting as a hang. – Harry Johnston May 8 '13 at 23:10
You can run it with /V option to show details what it does. – Razavi Aug 5 '15 at 7:16

Try /is which is "include same files". In my case, robocopy won't overwrite a file, but with this option, it will.

share|improve this answer

Robocopy will be able to overwrite files unless you tell it not to (using one of the /X* switches). If a file is locked that could hang it but actually Robocopy will retry, with defaults that means it can take a long time retrying a file. You could change the retry options so that it only retries a couple of times and perhaps doesn't wait very long between retries.

From robocopy.exe /?:

:: Retry Options :
/R:n :: number of Retries on failed copies: default 1 million.
/W:n :: Wait time between retries: default is 30 seconds.

/REG :: Save /R:n and /W:n in the Registry as default settings.

/TBD :: wait for sharenames To Be Defined (retry error 67).

Also, it's possibly it's recursively copying data through junction points. I always use the /XJ option in Robocopy operations to prevent this.

Questions as the devil's advocado:

  1. What command line are you using and can you give us the console output?
  2. Are you sure the files it's hanging on aren't just very big?
  3. Are you sure the files aren't locked?
  4. Are you running this interactive on the desktop? Could it be permissions-related?
share|improve this answer
Hi Neil ,Thanks for your answer. So,You mean to say that by default robocopy will overwrite the file if it is already there in the destination folder. – gautam kumar May 8 '13 at 12:02
It certainly should, yes. – Neil Barnwell May 8 '13 at 12:03
Can you please tell me what will be the exit code in that case? – gautam kumar May 8 '13 at 12:13
Certainly, though I'm not sure how it helps you: – Neil Barnwell May 8 '13 at 12:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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