无法编写将文件夹镜像到NAS驱动器的批处理脚本

时间:2021-10-09 00:26:09

I've been looking throughout the forum to find an answer and nothing. I just want to copy files from my desktop folder to my NAS drive. I wrote this script below and I got an error "You do not have the Manage Auditing user right.***** You need this to copy auditing information (/COPY:U or /COPYALL)" Any ideas why this wouldn't work or what the error means?

我一直在整个论坛寻找答案,什么都没有。我只想将文件从我的桌面文件夹复制到我的NAS驱动器。我在下面写了这个脚本,我收到一个错误“你没有管理审计用户权限。*****你需要这个来复制审计信息(/ COPY:U或/ COPYALL)”任何想法为什么这不会工作或错误意味着什么?

@ECHO OFF
SETLOCAL
SET _Source=C:\Users\desktop\folder
SET _dest=\\NASdrive\share\folder
SET _what=/COPYALL
SET _ options=/R:0 /W:0 /MIR /LOG:log.txt
ROBOCOPY %_source% %_dest% %_what% %_options%

2 个解决方案

#1


1  

This link might have an explanation - Robocopy /copyall

此链接可能有一个解释 - Robocopy / copyall

Says:

This thing with robocopy /copyall is that the first thing it does it change the permissions on the destination folder that you are copying into.

robocopy / copyall的这个功能是它首先改变了你要复制到的目标文件夹的权限。

I'm guessing your NAS doesn't appreciate robocopy changing permissions.

我猜你的NAS不喜欢robocopy更改权限。

COPYALL is equivalent to /COPY:DATSOU

COPYALL相当于/ COPY:DATSOU

/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
                     (copyflags : D=Data, A=Attributes, T=Timestamps).
                     (S=Security=NTFS ACLs, O=Owner info, U=aUditing info)

So you are telling Robocopy to set Attributes, ACLs, Owner, and Auditing Info on the destination drive. Since this is a NAS (and assuming not Windows) I don't think Robocopy can do this.

因此,您要告诉Robocopy在目标驱动器上设置属性,ACL,所有者和审核信息。由于这是一个NAS(假设不是Windows),我不认为Robocopy可以做到这一点。

#2


3  

You have a space between _ and options. Removing this space made the code work fine for me.

_和选项之间有空格。删除此空间使代码适合我。

#1


1  

This link might have an explanation - Robocopy /copyall

此链接可能有一个解释 - Robocopy / copyall

Says:

This thing with robocopy /copyall is that the first thing it does it change the permissions on the destination folder that you are copying into.

robocopy / copyall的这个功能是它首先改变了你要复制到的目标文件夹的权限。

I'm guessing your NAS doesn't appreciate robocopy changing permissions.

我猜你的NAS不喜欢robocopy更改权限。

COPYALL is equivalent to /COPY:DATSOU

COPYALL相当于/ COPY:DATSOU

/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
                     (copyflags : D=Data, A=Attributes, T=Timestamps).
                     (S=Security=NTFS ACLs, O=Owner info, U=aUditing info)

So you are telling Robocopy to set Attributes, ACLs, Owner, and Auditing Info on the destination drive. Since this is a NAS (and assuming not Windows) I don't think Robocopy can do this.

因此,您要告诉Robocopy在目标驱动器上设置属性,ACL,所有者和审核信息。由于这是一个NAS(假设不是Windows),我不认为Robocopy可以做到这一点。

#2


3  

You have a space between _ and options. Removing this space made the code work fine for me.

_和选项之间有空格。删除此空间使代码适合我。