使用robocopy时如何跳过现有和/或相同大小的文件 [英] How to skip existing and/or same size files when using robocopy

查看:1509
本文介绍了使用robocopy时如何跳过现有和/或相同大小的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此代码:

@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

如果文件存在,我不确定上面的代码是否包含"SKIP命令",如果文件大小相同,则跳过吗?

I am not sure if the code above has "SKIP commands" if file exists / or skip if file is the same size?

推荐答案

您要排除相同大小的文件还是未更改的文件?如果是后者,请使用RoboCopy中的/XO开关排除比复制过来的文件更旧的文件.

Do you want to exclude files of the same size, or files that haven't changed? If it's the latter, use the /XO switch in RoboCopy to exclude files that are older than those they're being copied over.

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

这篇关于使用robocopy时如何跳过现有和/或相同大小的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆