May I please get your insight?
I have a user group in AD call Contract Admin. I like would this user group to be able to run a script that clones a template folder (retaining permissions) to a new folder and prompt for a new client name.
The folder structure would be as follows:
- Clients
- New Folder (template folder) (Permissions: Admins, Contract Admin, Financial Admin)
- Statements Folder (Permissions: Financial Admin)
- New Folder (template folder) (Permissions: Admins, Contract Admin, Financial Admin)
End result after script:
- Clients
- ABC Company (Permissions: Admins, Contract Admin, Financial Admin)
- Statements Folder (Permissions: Financial Admin)
- ABC Company (Permissions: Admins, Contract Admin, Financial Admin)
Above is an example of the folder structure where New Folder is the template folder which also has a folder inside of it as well. I'd like to have the folders cloned with permissions retained.
I hope this is clear, I apologize if it is not. Thank you so much for your help.
The code I currently have for copying the permissions are as folows:
robocopy /e /copy:DATS "X:\Template" "X:\New Folder Name"
attrib -h "Template"
This is what I have for cloning the folders but I am lost from here. Thank you
Solution: @echo off
set "src=C:\Users\XXX\Desktop\template folder"
set /p "dest=Name of Client?: "
robocopy /e /copy:DATS %src% %dest%
the source can simply be the folder/file name without the full path if both the script and the folder/file to be copied is in the same directory.
/copy: Specifies the file properties to be copied. The following are the valid values for this option:
- D Data A Attributes
- T Time stamps S NTFS access control list (ACL)
- O Owner information
- U Auditing information
- The default value for
- CopyFlags is DAT (data, attributes, and time stamps).