在复制发生后,我使用现已弃用的 cacls 将自己重新添加进来。
rsync -avASPC sourceDir/* destDir
cacls destDir /t /e /r doej
cacls destDir /t /e /g doej:f
其中 sourceDir 是源目录,destDir 是目标目录,doej 是用户名。使用icacls可能会更好,但我还没有学会它。
我也尝试过 robocopy,但我似乎没有完成这项工作所需的权限。
用于 rsync 的标志
-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive recurse into directories
-l, --links copy symlinks as symlinks
-p, --perms preserve permissions
-t, --times preserve modification times
-g, --group preserve group
-o, --owner preserve owner (super-user only)
-D same as --devices --specials
--devices preserve device files (super-user only)
--specials preserve special files
-v, --verbose increase verbosity
-S, --sparse handle sparse files efficiently
-A, --acls preserve ACLs (implies -p, which is also implied by -a)
-P same as --partial --progress
--progress show progress during transfer
--partial keep partially transferred files
-C, --cvs-exclude auto-ignore files in the same way CVS does
从 CACLS 使用的标志
/T Changes ACLs of specified files in
/E Edit ACL instead of replacing it.
/R user Revoke specified user's access rights (only valid with /E).
/P user:perm Replace specified user's access rights.
Perm can be: ...
F Full control