[英]Copy a windows folder with its permissions but without overwritting the content
我想復制具有其權限的文件夾,但不復制其內容。 舉個例子:
C:\pictures and it has cat photos in it
我只想將許可復制到
D:\pictures (has other pictures)
我想復制到
E:\pictures (this folder is not existing)
我用robocopy
和icacls
嘗試過。 但是我無法使用icacls恢復數據:
icacls C:\pictures /save ntfspermissions.txt /c
icacls D:\pictures /restore C:\ntfspermissions.txt
它只是說: 1 error
。
在robocopy中,我使用參數“ /COPY:SAO
”進行了嘗試。 但是它也不起作用。 它只能與“ /MIR
”一起使用,但是如果我這樣做,我也會復制內容。
使用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
唐·瓊斯(Don Jones)的詳細解答: http : //technet.microsoft.com/zh-cn/magazine/2008.02.powershell.aspx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.