Bulk Copy Files & Folders Windows Robocopy

Robocopy

I should have written this long back considering how useful this is, but better late than never.

I have been using the Robocopy ‘Data Copy’ commands since years now, and it is one of
the handiest tools for any IT Administrator, a Must have and a Must know in my opinion.
Yesterday when I was shifting my Data to another Hard Disk, I wanted to use the
Robocopy commands. Generally, I google them every time and although these are quick to find, it’s not always definitive and I have to look at multiple Links. So, this time, I’ll document it for future reference for myself and others.

 *Open CMD as administrator and Type below Syntax

Robocopy {Source path} {destination path} <options>

Eg, To copy contents of test1 folder to test2, the command would be as below, also a good option would be to create a Log file to see the result

robocopy “D:\test1” “D:\test2” /E /DCOPY:DAT /COPYALL /R:2 /W:5 /log:D:\log1.txt

Copy Options or sometimes called switches detail

/s– Copies subdirectories. This option automatically excludes empty directories 

/e– Copies subdirectories. This option automatically includes empty directories.

/copy:<copyflags>-  Specifies which file properties to copy. The valid values for this
option are:

D – Data  
A – Attributes
T – Time stamps
S – NTFS access control list (ACL)
O – Owner information
U – Auditing information
The default value for this option is DAT (data, attributes, and time
stamps).

/dcopy- what to COPY for directories (default is /DCOPY:DA). (copyflags : D=Data, A=Attributes, T=Timestamps)

/copyall– Copies all file information (equivalent to /copy:DATSOU). 

/mir– Mirrors a directory tree (equivalent to /e plus /purge). Using this option with the /e option and a destination directory, overwrites the destination directory security settings. 

/move– Moves files and directories, and deletes them from the source after they are copied.

/256– Turns off support for paths longer than 256 characters. (By default, paths longer than 256 will be copied) *important  /log:<logfile> – Writes the status output to the log file (overwrites the existing log file). *important 

 /log:<logfile> – Writes the status output to the log file (overwrites the existing log file). *important 

Sometimes when you have copied files and folder from a root directory, it may set the directory/folder attributes to hidden at the destination, the solution to that is as below

Type this command in CMD

attrib -s -h “folder name”

To avoid this issue, you can include /A-:SH when copying the directory/folder

Other Attribute switches

Robocopy GUI

Also, the best part is, there are many applications which enable to do all these things from GUI, which makes it simple and quick. Here’s a list of some of them below.

  • ChoEazyCopy
  • Easy robocopy
  • Robocop Robocopy
  • SH Robocopy GUI
  • WinRoboCopy
  • Robocopy GUI

Useful Ref Sources for more information

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

https://www.codeitbro.com/best-robocopy-gui-for-windows/

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.