排除批量复制脚本文件夹 [英] Exclude folders in batch-copy-script
问题描述
我使用的U盘一个批处理文件备份我的照片。我用下面的命令:
I am using a batch file on a USB stick to backup my pictures. I use the following command:
for /r C:\ %%x in (*.jpg *.png *.gif) do @copy /y %%x .
我想在mailfolder排除文件窗口和程序文件。
I want to exclude files in the mailfolder WINDOWS and PROGRAM FILES.
有没有人有一个想法,我怎么可以用一个批处理文件做到这一点?
Does anyone have an idea how I can do this with a batch file?
推荐答案
挂断复制
和使用的 ROBOCOPY
存在于Windows Vista中+&放大器;可下载的早期版本。
Drop COPY
and use ROBOCOPY
which exists in Windows Vista+ & is downloadable for prior versions.
它支持 / XD
来排除特定的目录和放大器; / XF
在命令行排除文件口罩。
It supports /XD
to exclude specific directories & /XF
to exclude file masks at the command line.
例如
robocopy.exe c:\ c:\destination\ *.jpg *.png *.gif /xd "Program files" "windows" /S
(注意:这将重新在c目录结构:\\目标\\,其中关于它的思考可能不是你想要的)
(Note this will recreate the directory structure in c:\destination\, which thinking about it may not be what you want)
这篇关于排除批量复制脚本文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!