Dos批量复制所有文件,除了一个不工作

时间:2015-12-28 10:16:04

标签: dos xcopy exclusionpath

Move all files except some (file pattern) from a DOS command

我想将发布目录中的所有文件复制到该批处理文件的部署目录:

echo off

set "source=.\EasyRun\bin\Release\"
set "destination=C:\temp\EasyRun\"

IF exist %destination%  rd %destination% /s /Q

IF exist %source% ( echo "OK release") ELSE ( echo "NO Realease DIR "%source% && pause && exit )

dir /b /a-d %source%|findstr /b "vshost" > excludeList.txt
xcopy /s %source%"*.exe" %destination% /exclude:excludeList.txt
xcopy /s %source%"*.dll" %destination%

echo "OK!!"
Pause

所以这里有两个问题:

  1. 未填写excludeList且文件为空
  2. 即使我手动输入。\ EasyRun \ bin \ Release * .vshost.exe,xcopy也不会将其排除在复制之外。
  3. enter image description here

    感谢

1 个答案:

答案 0 :(得分:0)

可能是由空的excludeList.txt引起的。 - >尝试输入虚拟条目

我在xcopy和网络共享方面遇到了一些问题。 (由于延迟,访问限制,我收到了错误......)

我建议使用/ xf选项进行robocopy。例如/ xf vshost 此外,/ MT [:N]多线程副本应加快复制过程。