For my tech geek friends, I learned a new feature of robocopy today. (Source)
I had to recreate the directory structure of one server on another server, including permissions. At first I copied the files over with xcopy and then started comparing permissions. After three folders (out of hundreds), I got bored and figured there had to be a better way.
There was.
Robocopy was something I played around with back in my DOS 6.22 days. And it’s still around (which is pretty cool).
So for the curious, if you ever need to replicate a directory structure from one machine to another (or even on the same machine) and include file permissions, the below is what will do it for you:
robocopy "source" "destination" /e /z /SEC /xf *
source – your source directory.
destination – your destination directory
/e – include empty subdirectories (use /s if don’t want empty subdirectories)
/z – copy in recoverable mode (in case of error)
/SEC – copy permissions
/xf * – exclude files matching * (everything)
Thus ends today’s geek lesson.