Robocopy /purge 没有清除并且 /XD 没有排除目录?

Robocopy /purge 没有清除并且 /XD 没有排除目录?

我正在尝试构建 Robocopy 脚本来复制我的旧 synctoy,但我的语法似乎有问题。

使用以下命令,我想排除..\local settings\Temp 和 ... \local settings\Application Data 我还尝试清除目标 NAS 中的这些目录。

robocopy C:\users\dancedad \\dancedadnas\workbackups\Laptop /mir /XD /e "C:\Users\dancedad\AppData" /z /mt:16 /w:5 /r:3 /XD "C:\users\dancedad\Local Settings\Temp" /XD "C:\users\Dancedad\Local Settings\Application Data" /XF *.tmp /PURGE /log:C:\users\Dancedad\documents\robolog.txt /SAVE:LaptopSync

输出 robolog.txt 似乎显示了 Exc 目录,但是当您查看日志时,它仍然是从该路径镜像的?而且我没有清除,而是得到了 *Extra Dir 条目。

>-------------------------------------------------------------------------------
>   ROBOCOPY     ::     Robust File Copy for Windows                              
>-------------------------------------------------------------------------------
>
>  Started : Tuesday, May 16, 2023 07:31:08
>   Source : C:\users\DanceDad\
>     Dest : \\DanceDadNas\workbackups\Laptop\
>
>    Files : *.*
>       
>Exc Files : *.tmp
>       
> Exc Dirs : C:\Users\DanceDad\AppData
>       C:\users\DanceDad\Local Settings\Temp
>       C:\users\DanceDad\Local Settings\Application Data
>       C:\users\DanceDad\Application Data\discord
>       
>  Options : *.* /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /Z /MT:16 /R:3 /W:5 
>
>------------------------------------------------------------------------------
>       Newer                865    C:\users\DanceDad\My Documents\robolog.txt
>100%  
>
>     *EXTRA File         189753    \\DanceDadNas\workbackups\Laptop\.cisco\vpn\log\UIHistory_20230515_162859_log.txt
>       Newer                157    C:\users\DanceDad\Application Data\Slack\local-settings.json
>100%  
>       Newer                  0    C:\users\DanceDad\Dropbox\.dropbox.cache\marker_file
>100%  
>       Newer                 64    C:\users\DanceDad\Local Settings\ESRI_Licensing\README.txt
>100%  
>       Newer             821425    C:\users\DanceDad\Local Settings\Discord\Discord_updater_rCURRENT.log
>100%  
>       Newer             225280    C:\users\DanceDad\Local Settings\Discord\installer.db
>100%  
>       Newer             364757    C:\users\DanceDad\Local Settings\LogiOptionsPlus\settings.backup
>100%  
>       Newer             364782    C:\users\DanceDad\Local Settings\LogiOptionsPlus\settings.json
>100%  
>   *EXTRA Dir        -1    \\DanceDadNas\workbackups\Laptop\Local Settings\Temporary Internet Files\Content.IE5\KF34TA3A\
>   *EXTRA Dir        -1    \\DanceDadNas\workbackups\Laptop\Local Settings\Temporary Internet Files\IE\KF34TA3A\
>   *EXTRA Dir        -1    \\DanceDadNas\workbackups\Laptop\Local Settings\Temporary Internet Files\Content.IE5\L3QGXQV9\
>   *EXTRA Dir        -1    \\DanceDadNas\workbackups\Laptop\Local Settings\Temporary Internet Files\IE\L3QGXQV9\
>       Newer             159744    C:\users\DanceDad\Local Settings\WebEx\CiscoMeetings.db
>100%  
>       Newer              10354    C:\users\DanceDad\Recent\CustomDestinations\a55ed4fbb973aefb.customDestinations-ms
>100%  
>       Newer                 24    C:\users\DanceDad\Recent\CustomDestinations\f18460fded109990.customDestinations-ms
>100%  
>       Newer               2246    C:\users\DanceDad\Application Data\Microsoft\Credentials\FB4C8F2787CF103F364B7EC977B70EED
>100%  
>       Newer             16.2 m    C:\users\DanceDad\Application Data\Microsoft\Teams\logs.txt

答案1

不能/e位于/XD要排除的路径之间:

robocopy ... /XD /e "C:\Users\dancedad\AppData" ...

由于您显然打算创建空目录,这可能就是您的意图:

robocopy ... /e /XD "C:\Users\dancedad\AppData" ...

结果是:

robocopy C:\users\dancedad \\dancedadnas\workbackups\Laptop /mir /e /XD "C:\Users\dancedad\AppData" /z /mt:16 /w:5 /r:3 /XD "C:\users\dancedad\Local Settings\Temp" /XD "C:\users\Dancedad\Local Settings\Application Data" /XF *.tmp /PURGE /log:C:\users\Dancedad\documents\robolog.txt /SAVE:LaptopSync

相关内容