How to copy only security information with Robocopy

This one is more of a quick note.

I had copied files from an old file server to a new one and thought the permissions moved over fine. For some reason, ownership and permissions didn’t match.

I needed a straightforward way to fix the permissions due to the volume of data I was dealing with. This did the trick for me:

robocopy <source> <destination> /secfix /copy:atsou /e /xx /xd Dfsrprivate 

/secfix fixes file security info but needs details on what to correct

/copy:atsou says to grab all information except for Data (it would be DATSOU in that case.) My memory trick for the /copy: switch is if someone says Atsou.. you say bless you. You only pass information with them and don’t want their content 😉

/e is subdirectories, even empty ones

/xx will ignore new files or folders in case changes were made since

/xd Dfsrprivate  (Folder to avoid.  You can skip this if you don’t use DFS replication)