Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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 *
share|improve this answer
add comment

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.

share|improve this answer
    
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 '13 at 16:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.