【问题标题】:Copy all txt files from all subfolders using xcopy使用 xcopy 从所有子文件夹中复制所有 txt 文件
【发布时间】:2015-09-30 16:25:44
【问题描述】:

我的任务是将所有 .txt 文件从 Program Files 文件夹及其所有子目录复制到我创建的另一个文件夹中。我的脚本:

xcopy c:\"program files"\*\*.txt c:\temp\myfiles\lessons

不想工作。我错过了什么?

【问题讨论】:

  • 这和python有什么关系?
  • 我对 xcopy 一无所知,但那条路径看起来很有趣。如果您尝试xcopy "c:\program files\*\*.txt" c:\temp\myfiles\lessons,会发生什么?

标签: command-prompt xcopy


【解决方案1】:

如果要保持文件夹结构,

xcopy /s "c:\program files\*.txt" c:\temp\myfiles\lessons

如果没有,

for /r "c:\program files" %a in (*.txt) do @copy /y "%a" c:\temp\myfiles\lessons

【讨论】:

  • 不错的一个。 :) 为我工作。
猜你喜欢
  • 2016-12-17
  • 2018-06-06
  • 1970-01-01
  • 1970-01-01
  • 2017-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多