Copy folder along with security parameters (ACL) using Robocopy utility

Robocopy is very useful Microsoft provided utility and it comes preinstalled in SQL Server 2008 onwards and can be installed via rktools.exe toolkit in Windows Server 2003 (link)


You can check if Robocopy is installed or not via opening command prompt as, Run>CMD> <type Robocopy /?>

If it shows parameter list then Robocopy is installed on your system else download and install (if you are not allowed to install anything on your server, then download locally where allowed and run installer, it will extract all files to your designated folder, just copy robocopy.exe from there and paste in C:\Windows\system32\ folder on your server and you are done)


My requirement was to copy all data from old drive to new drive and keep all manually set security settings intact, say for e.g. I need to sync E: to Z: then command looks like,


ROBOCOPY E:\ Z:\ *.* /E
/LOG:C:\MyLogfileEtoZ.txt /NP


Note: if you want to mirror or sync data then use references below as these have some examples to automate this for you. Also note that if your source and destination has fodler locations with space in it then don’t put \ at end for e.g. “E:\database files\data directory” don’t put \ after data directory as it will lead to errors,


Syntax is:

  • Robocopy
  • <Source location>
  • <Destination location>
  • <type of files to be copied, if all then use *.* and in case only MS doc then *.doc, etc.>
  • <Parameters to assist copy, /E means copy all folder and subfolders including empty, /SEC means copy security settings, /COPYALL means copy all file info, /R:2 means retry twice if copy of a file or folder failed, /W:1 means wait for 1 sec between each retry, /Log means where to place log file>
  • <Now after log it contains all parameter pertaining to what needs to be logged, /NP means don’t log progress, in case you need percentage progress of files being copied then remove this parameter, /ETA means log the estimated time of arrival of file to destination, useful when copying files which are large in size say each file in GB’s>


Other parameters can also be included based on requirement, find the useful reference below to get help further.


Useful resources to help you write more suitable robocopy commands,




Download PDF

About the Author: Nitin G

Indian born, trekker, biker, photographer, lover of monsoons. I've been working full time with SQL Server since year 2005 and blogs to post the content aquired during my research on new topics or fixing issues faced by me as a DBA while working in different kind of projects, hope some of my posts may helps others in SQLDBA community. Everything you read on my blog is my own personal opinion and any code is provided "AS-IS" with no warranties!

Leave a comment

Subscribe to this blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 263 other subscribers

Translate this blog!



December 2020
« Nov    

View Post by Categories

%d bloggers like this: