我正在尝试执行 xcopy /o 等效于复制带有子目录的模板文件夹,这些子目录包含自己的适当 acl,以在 windows 2008 服务器环境中创建具有相同子目录及其各自 acl 的新目标目录。
例如..
the template directory would be templatedir
- sql
- pm
- dev
targetdir
- sql
- pm
- dev
每个子目录具有相同的 acl
这是我到目前为止想出的
PS C:\> dir c:\templatefolder -recurse | where {$_.PSIsContainer} | foreach {
$target= ($_.fullname).replace("C:\templatefolder","D:\targetfolder")
Get-Acl $_.Fullname | Set-Acl $target -whatif
}
我该如何修改它以使其包含继承并复制模板目录的 acl?它目前只处理子文件夹。提前致谢