Easily manage and duplicate folder permissions on Windows Server AD

network-sharepermissionswindows-server-2012-r2

Context: Imagine I have 3 group of users (X, Y and Z), and the following folders:

[Folder] : [Groups who have access]

Folder A : X, Y, Z
—- Folder 1 : X, Y
—- Folder 2 : Y, Z
—- Folder 3 : X, Z
——— Folder 3.1 : X

@Edit: The idea is create a Folder A for each projetct, so they are better organized and categorized. Examples of folders 1, 2, 3 could be Manuals, Doccuments, Active, Obsolete, those kind of stuff..

Situation: I must duplicate A an uncertain amount of times and I'd like to keep the folder structure and permissions (e.g. when I create B it already have 1, 2, 3 and 3.1 folders, with same permissions as A).

Windows Server does not preserve the permissions when copying and pasting folders, and so far I've been using .bat scripts to do the job.

However, I think it consumes a lot more time to do that than it should.

@Edit:

IMPORTANT: The folder's (A, B, C, …) structure and permissions are the same, but the files in it are not.


Questions are:

  1. Is there an easier way of duplicate A? Perhaps a software that helps me managing this..
  2. Is there any way of, if A child's permissions come to change, I automatically "deploy" them to the other copies (B, C, …)?

Assume that folder 1, 2, 3 and 3.1 all have the same name on A, B, …, Z.

Thank you very much.

Best Answer

The quickest way to do this assuming you already have a "template" folder is with the built-in robocopy tool.

If you want to duplicate the folder and all of the files, you can use it like this. The /copyall flag is what copies the permissions and /mir makes sure the destination includes no more and no less than what was in the source.

robocopy .\FolderA .\FolderB /copyall /mir

If all you want is the folder structure and none of the files, you might do something like this. The /e flag explicitly includes empty directories and /xf * excludes all files.

robocopy .\FolderA .\FolderB /copyall /e /xf *

If you want to get fancy and/or not have to rely on a template folder, your best best would be to script the folder creation and ACL settings via PowerShell. I won't go into details here as there are plenty of examples out there.