Windows Command Line: Robocopy Command Syntax and Examples
Windows Command Line: Robocopy Command Syntax and Examples
≡ MENU
Robocopy command is used on Windows to copy files and directories from one location to
another. This CMD command also prints a detailed report of the copy operation. Below you
can find examples for using Robocopy in various usecases.
Copy a directory
Example: Copy all the files in the directory D:\dir1\data to E:\backup\data. Don’t include
sub directories or the files stored in those.
The above command copies system files and hidden files too. Copy and Xcopy commands
skip these files by default.
At the end of the command execution, it would print the summary like below.
Run the below Robocopy command to copy directory structure i.e deep copy of folder
hierarchy and the data in all the subfolders.
https://www.windows-commandline.com/robocopy-command-syntax-examples/ 1/6
22/12/2017 Robocopy command syntax and examples
This command does not copy empty directories. To copy them, you need to add /E switch.
For example to copy all files from one directory to another directory and also set hidden
attribute for all the files you can trigger ‘Robocopy’ with the below syntax.
https://www.windows-commandline.com/robocopy-command-syntax-examples/ 2/6
22/12/2017 Robocopy command syntax and examples
This command also deletes any extra files that are present in the destination and are not
present in source.
Note that Robocopy copies the security ACLs also to the destination only if the file has been
modified. If the file has not been modified, the ACLs won’t be applied on the destination.
You can check this Microsoft’s post robocopy file permissions for deeper understanding.
alex gross
In Windows XP i could bring up two separate Windows Explorers boxes, one for the C drive
& one for the D drive in my computer, or even one for the C drive & one for an external disk
drive. I could then freely move entire directories from one drive to another with a single key
press. How precisely do i do this in Windows 8.1, which so far permits me to bring up only
one instance of “File Explorer.” I have only been using WIN 8.1 for a few hours, but the
command prompt commands i have seen you suggest so far look primitive & like a
throwback to DOS
REPLY LINK
admin
Even in Win8, you can open multiple instances of explorer. Run ‘C:’ and ‘D:’ separately
from Run, it would open C: and D: drives in two explorers. you can copy/move files
with single click.
LINK
MLKennedy
https://www.windows-commandline.com/robocopy-command-syntax-examples/ 3/6
22/12/2017 Robocopy command syntax and examples
Alex, Primarily this is used as an administrator when you have a lot of folders/files to
move and want to retain user permission settings. It would be a nightmare to have to
move a bunch of files and then have to rebuild the permissions.
You, sound like an end user, so all you need to do is open a couple of windows and drag
and drop.
LINK
Rich
Thanks for the article: do you know if there is a way to use robocopy to copy all the files
from a folder and its sub folders into a single destination folder without any of the source
sub folder structure? In other words I need the destination to find all files of a file type
(PDF) and COPY them all to a single folder…
REPLY LINK
admin
You can use forfiles for this. Refer: http://www.windows-commandline.com/forfiles/
LINK
pradeep
Thank You :)
REPLY LINK
Sankalp Shah
REPLY LINK
noob
how can i copy 2 types of files in one line of script? Eg, *.doc and *.xls
REPLY LINK
Jeff
How can I copy all only/all folders in my directory that have “DONE” in the folder name?
This is part of a backup routine and there are several hundred folders with “DONE” in the
name, these are the only ones I want to copy including all the sub folders and files?
Best Regards,
https://www.windows-commandline.com/robocopy-command-syntax-examples/ 4/6
22/12/2017 Robocopy command syntax and examples
REPLY LINK
Frank.l
I have windows 10 home edition. I used the copy command as described but I got an error
message “access denied”.
I have been trying repeatedly to use normal copy command but as soon as I push enter the
folder disappears.
REPLY LINK
Perry
Will the SID be affected by using ROBOCOPY to restore a server after its been renamed?
REPLY LINK
Amar Kumbhar
REPLY LINK
Sudeeesh Kamath
REPLY LINK
asic
REPLY LINK
Ganesh
Can someone please assist me how can move folders and files with permission from:
Suppose Drive T:\ to Drive M:\ between same domain and same server
I would like to delete all while it is moving.
Date range is prior Dec 31st 2016
Using powershell
https://www.windows-commandline.com/robocopy-command-syntax-examples/ 5/6
22/12/2017 Robocopy command syntax and examples
REPLY LINK
Leave a Comment
Name *
Email *
Website
Comment
Submit
E-mail Newsletter
E-mail Subscribe
https://www.windows-commandline.com/robocopy-command-syntax-examples/ 6/6