2

I'm in the process of creating a secondary website on our webserver which I would like to have identical folder and (mostly) file permissions but completely different content. Ideally I would like to just dump the permissions from the source folder structure and import it into the new folder structure.

I've looked at Sysinternals tools, command line, and powershell options and they don't seem to do exactly what I want. What would be the best way to do what I want?

2 Answers 2

1

You can do this with robocopy.

Assuming a source C:\inetpub\site1 and destination of C:\inetpub\site2, the following will create an identical folder hierarchy under "site2", preserving the permissions of "site1".

robocopy C:\inetpub\site1 C:\inetpub\site2 /mir /copyall /xf *
  • /mir Mirror
  • /copyall Copy all permissions
  • /xf * Exclude files matching *
0

Have you looked at icacls? You could just have icacls spit out the acls to a file and then use the file to set permissions on the destination.

Or you could just use xcopy to copy your folders to the new inetpub/wwwroot and then replace the files that need replacing:

Copy a Folder to Another Folder and Retain its Permissions

Click Start, and then click Run. In the Open box, type cmd, and then click OK. Type xcopy sourcedestination /O /X /E /H /K and then press ENTER, where source is the source path for the files to be copied, and destination is the destination path for the files.

1
  • I did but the file had challenges importing to the new folder structure and the errors thrown didn't help much with localizing the error.
    – Techie Joe
    Mar 21, 2013 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .