gpt4 book ai didi

batch-file - 使用 robocopy 时如何跳过现有和/或相同大小的文件

转载 作者:行者123 更新时间:2023-12-04 03:07:07 26 4
gpt4 key购买 nike

我有这个代码:

@echo on
set source="R:\Contracts\"
set destination="R:\Contracts\Sites"

::Not sure if this is needed
::It guarantees you have a canonical path (standard form)
for %%F in (%destination%) do set destination="%%~fF"

for /r %source% %%F in (.) do if "%%~fF" neq %destination% ROBOCOPY "%%F" %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0

Pause

我不确定上面的代码是否有“跳过命令”(如果文件存在)/或如果文件大小相同则跳过?

最佳答案

您要排除相同大小的文件,还是未更改的文件?如果是后者,请使用 /XO在 RoboCopy 中切换以排除比它们被复制的文件更旧的文件。

RoboCopy "%%F" %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /XO /R:0

关于batch-file - 使用 robocopy 时如何跳过现有和/或相同大小的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8935583/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com