【问题标题】:How to create an exclude file entry for xcopy that matches the extension of a file name?如何为 xcopy 创建与文件名扩展名匹配的排除文件条目?
【发布时间】:2012-12-28 08:46:53
【问题描述】:

考虑以下批处理语句:

for / %f in (C:\temp\cool\*) do if not "%~nf" == "update" 
    xcopy /r /Y /S /D:01-01-2001 /EXCLUDE:excl.txt %f c:\temp\%~nf\

它使用带有排除列表的文件。这个excl.txt 看起来像:

.config
.log

它应该跳过所有文件日志和配置文件。不幸的是,它也跳过了这个文件:

cfw.loginpopup.js

我该如何解决这个问题?我只喜欢排除 .log 结尾的文件。

【问题讨论】:

    标签: windows batch-file command dos xcopy


    【解决方案1】:

    也许我想的太简单了,但是你可以试试这个排除列表:

    *.config 
    *.log
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-31
      • 1970-01-01
      • 2014-01-04
      • 1970-01-01
      相关资源
      最近更新 更多