Using Robocopy to Copy Entire Directories

by Barry Dysert
(last updated September 21, 2017)

7

Robocopy is the tool to use when working with entire directories, since that's what it was designed to do. If you only want to copy a directory (and its included files) to another directory, you can use the basic syntax for Robocopy, and you need not specify any options. So let's say you have a directory tree that looks like this:

C:\Temp1\Temp2

The Temp1 directory contains a file named T1.tmp. The Temp1\Temp2 directory contains a file named T1T2.tmp.

Now, let's say you want to copy the Temp1 directory (and its files) to a new directory called C:\Temp3. The command to do this is:

ROBOCOPY C:\Temp1 C:\Temp3

Robocopy creates the C:\Temp3 directory and copies the files from the C:\Temp1 directory into it. If you want to copy the entire directory tree under C:\Temp1 you just need to add the /E switch to the command:

ROBOCOPY C:\Temp1 C:\Temp3 /E

This results in the creation of C:\Temp3, and all of the files and folders under C:\Temp1 will be copied to the newly built tree under C:\Temp3.

 This tip (13188) applies to Windows 7, 8, and 10.

Author Bio

Barry Dysert

Barry has been a computer professional for over 30 years, working in different positions such as technical team leader, project manager, and software developer.  He is currently a senior software engineer with an emphasis on developing custom applications under Microsoft Windows. ...

MORE FROM BARRY

Understanding Windows Firewall

There are a lot of malicious users on the Internet who are trying to break into other people's systems. One way to mitigate ...

Discover More

Starting Applications Automatically when Starting Windows

Understanding the Task Scheduler is a great asset when you want your computer to do things automatically. This tip shows you ...

Discover More

Setting Up Your Wi-Fi Enabled Computer As a Hotspot

If your computer is Wi-Fi enabled, you can easily set it up to be a hotspot. This tip shows you how.

Discover More
More WindowsTips

Clearing Items from the Recently Used Documents List

You may wish to clear your Recently Used Documents list or even have them not remembered in the first place. How you clear ...

Discover More

Getting Rid of Hidden Thumbs.db Files

A hidden file that the system uses to speed performance of your viewing folders containing pictures is called Thumbs.db. ...

Discover More

Understanding File Paths

Every file on your disk drive has a unique file path that defines its location. Understanding how file paths work can be ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 - 0?

2017-03-21 13:12:26

Allen

Austin: that is the system prompt, shown automatically by Windows in the command prompt window. If you are actually "on" a different drive or in a different directory, then the system prompt will reflect your current path.

-Allen


2017-03-21 13:02:08

Austin Woitte

What is the purpose of the "C:\>" before ROBOCOPY?

It seems to me that ROBOCOPY C:\Temp1 C:\Temp3 is saying robocopy Temp1 into Temp3, so why is there a C:\> before all of it?


2016-09-19 17:24:10

Barry

I have not tried Robocopy on Win10. Sorry.


2016-09-19 09:55:06

luis carlos

Does this works in windows 10?
I installed Robocopy GUI in W10 and can't copy a folder from one HD to another HD folder. Any help?


2016-08-31 04:28:11

Barry

The only clue I have is that you don't have permission. Note that even if you're the local admin, there are some things you can't do; this appears to be one of them. Sorry I can't be of more help.


2016-08-30 23:29:14

Frank Lindner

I use windows 10 home.

I am trying to copy 'GroupPolicy' directory from C:windowssyswow64 folder to the C:windowssystem32 folder.

Using normal copy/paste it does not work (wont paste).
I tried Roboform copy instead but got an error message saying "access denied" ?

Any clues please.


2015-02-21 05:54:47

mike

In this link,you find some script example to copy files to a Nas using Robocopy and to create a mail report

http://pronetwork.altervista.org/forums/topic/robocopy-backup-with-mail-report/


Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.