2013-11-03

用robocopy复制数据到映射的网络盘

公司的电脑应用了组策略,复制数据到连接到本地的USB设备时要求USB必须是加密过的设备,否则拒绝复制数据。这给备份数据时带来了点麻烦。我把一个外接硬盘(文件系统为NTFS)挂载到了一个Android设备上,用samba共享出来供备份数据,没想到用robocopy复制数据时总是得到错误:
"ERROR 5 (0x00000005) Changing File Attributes ... Access is denied".

For the error (ERROR 5), you need to turn off the attribute copying. Robocopy uses the /COPY:DAT by default, which means to copy data, attributes and timestamp. You should turn off attribute copying by explicit setting /COPY:DT.

使用/COPY:DT仅仅复制D(data)和T(timestamp)

robocopy source target /MIR /COPY:DT /UNICODE

当复制一个文件失败时,默认的重试次数是一万次。这个对于我来说基本是浪费时间,所以还是加上一个retry的参数吧

robocopy source target /MIR /COPY:DT /UNICODE /R:3