使用xcopy复制所有子文件夹中的所有txt文件

3

我被指派复制Program Files文件夹中以及其所有子目录中的所有.txt文件到我创建的另一个文件夹中。 我使用的脚本如下:

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

不想工作。我漏掉了什么?

2
这与 Python 有什么关系? - Morgan Thrapp
我对xcopy一无所知,但那个路径看起来很有趣。如果你尝试使用xcopy "c:\program files\*\*.txt" c:\temp\myfiles\lessons会发生什么? - Kevin
1个回答

14

如果你想要保留文件夹的结构,

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

不错哦。 :) 对我有用。 - Naveen Kumar V

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接