I'm trying to do an xcopy /o equivalent to copy a template folder with subdirectories which contain their own appropriate acl to create a new target directory with the same subdirectories and their respective acl in a windows 2008 server environment.
for example..
the template directory would be templatedir
- sql
- pm
- dev
targetdir
- sql
- pm
- dev
with each subdir having the same acl
here is what i have come up with so far
PS C:\> dir c:\templatefolder -recurse | where {$_.PSIsContainer} | foreach {
$target= ($_.fullname).replace("C:\templatefolder","D:\targetfolder")
Get-Acl $_.Fullname | Set-Acl $target -whatif
}
how do i modify this so it includes the inheritance and copies the templatedir's acl? it currently only does the subfolders. thanks in advance