

To include the owner of a file or folder use the /copy:DATSO command. You can see these permissions copied over to the destination folder. On the source, I modified the permissions on the accounting folder. Here is a screenshot comparing the permissions on one of the folders. robocopy c:\share c:\it\dst /e /copy:DATS

This does not copy owner information, see example 4 to include the owner. If you have modified the permissions on files and folders and want to keep those permissions, you need to use the /copy:DATS option. Copy Contents With Security (ACL Permissions) This time the destination folder looks just like the source folder. Here is a screenshot of the command from my computer. This time I will use /e command to include empty subdirectories. In this example, I’m going to copy all the files and folders from c:\share to the folder c:\it\dst on the same computer. Copy Contents Include Empty Subdirectories Why did robocopy only copy the “Windows Defender” folder? Because the other folders are empty, the /s command will exclude subdirectories that are empty. Here is a screenshot showing the comparison between the source and destination folders. This will exclude any empty subdirectories. Copy Contents Exclude Empty Subdirectories The /l is a great command to help you understand what it would have done without making any real changes. This time the test showed it would copy a bunch of files and directories. I’ll run another test and include the /e option. You can see below this command would have copied one directory. This is a great way to test a command without making any real changes, it will show you what it would have done. You can test a file copy with the /l command. Test A File Copy Without Any Real Changes In this guide, I’ll show you the best robocopy commands and examples. Robocopy has many command line options and it can be overwhelming to know which commands to use. Looking for a list of robocopy examples and useful commands? Then look no further.
