Using Robocopy to Copy Entire Directories

by Barry Dysert
(last updated August 4, 2014)

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:

C:\> 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:

C:\> 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 and 8.

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

Disabling Automatic Updates

If you don't like that Windows automatically downloads and applies updates in the middle of the night, you can gain some ...

Discover More

Changing a Program's Compatibility Settings

If an older program no longer runs under Windows, you may still be able to get some life out of it by changing its ...

Discover More

Understanding the Pictures Folder

The Pictures folder is one of several system libraries specifically optimized to hold digital pictures. This tip tells you ...

Discover More
More WindowsTips

Understanding Storage Spaces

Need to add some addition drive space to your system? Why not consider adding what Microsoft calls a "storage space?" This ...

Discover More

Understanding Robocopy

Robocopy is a robust file copy utility built into Windows. If you have a lot of file management to do that can't easily be ...

Discover More

Removing a File Type Program Association

Removing a file type program association is a task for third-party utilities. You can, however, change the association ...

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. 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 + 5?

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.