batch file - Copy a windows folder with its permissions but without overwritting the content -
batch file - Copy a windows folder with its permissions but without overwritting the content -
i want re-create folder permissions without copying content. example:
c:\pictures , has cat photos in
i want re-create permission to
d:\pictures (has other pictures)
and want re-create to
e:\pictures (this folder not existing)
i tried robocopy
, icacls
. not able restore info icacls:
icacls c:\pictures /save ntfspermissions.txt /c icacls d:\pictures /restore c:\ntfspermissions.txt
and says: 1 error
.
in robocopy tried parameter "/copy:sao
". not working too. works "/mir
" if that, have content copied too.
use get-acl , set-acl :
$acl=get-acl -path c:\pictures set-acl -path d:\pictures -aclobject $acl new-item -itemtype directory -name pictures -path e:\ set-acl -path e:\pictures -aclobject $acl
more detailed reply don jones : http://technet.microsoft.com/en-us/magazine/2008.02.powershell.aspx
windows batch-file permissions folder
Comments
Post a Comment