我有两个包含相同文件的目录。在源目录上,我总是进行更新。现在我只想将更新的文件从源目录复制到目标目录。所以这就像更新文件而不是复制所有文件。
我还尝试过“复制最新文件的批处理脚本”。虽然它运行良好,但它只复制最新的文件。
有什么可以比较目录中文件的日期吗?
I have two directories with the same files. On the source directory, I always make updates. Now I just want to copy the updated files from the source directory to the destination directory. So it would be like updating files instead of copying all files.
I had also tried on the "Batch script to copy newest file". Though it worked well but it only copies the newest files.
Is there something that could compare the dates of the files from the directories?
发布评论
评论(3)
查看RoboCopy,它有用于过滤的开关基于日期的文件
Check out RoboCopy, it has switches for filtering files based on dates
如果您想将文件或图像从一个网络复制到另一个网络,则可以使用命令robocopy。
If you want to copy the files or images from one network to another network then you can use the command robocopy.
以下语句将复制新文件和更新的文件:
/L
表示 robocopy 创建要复制的文件列表。/L
表示 robocopy 尚未复制文件。/xo
排除较旧的文件(请参阅最后的文档)/xx
排除额外文件(请参阅最后的文档)有用的选项添加:
/s
包含子文件夹/r:0 /w:0
总结一下:不重试,否则 robocopy 会尝试 1,000,000 次,每次尝试之间暂停 30 秒/xd "?recycle.bin"
排除回收站/mt
多线程:它将加快进程/np
无进度条/log:"robocopy.log"
不将输出发送到屏幕,而是发送到文件 robocopy.log该文档解释了日志文件的内容。
我通过 广泛的 robocopy 文档 superuser.com/questions/791053/how-does-robocopy-define-if-a-file-is-changed">这个问题。
The following statement will copy new files and updated files:
/L
means that robocopy creates a list of files to be copied./L
means that robocopy will not yet copy files./xo
exclude older files (please refer to the documentation at the end)/xx
exclude extra files (please refer to the documentation at the end)Useful options to add:
/s
include subfolders/r:0 /w:0
to summarize: no retries, otherwise robocopy tries 1,000,000 times pausing 30s between each try/xd "?recycle.bin"
exclude the recycle bin/mt
multithreaded: it will speed up the process/np
no progress bar/log:"robocopy.log"
do not send output to the screen but to the file robocopy.logThe documentation explains the contents of the logfile.
Extensive robocopy documentation that I found via this question.