windows xcopy txt 中的所有文件夹和子文件夹(带有路径和空格)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6791491/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 08:36:19  来源:igfitidea点击:

xcopy all folders and subfolders from txt(with paths , and spaces )

windowsbatch-filecmdxcopy

提问by massaki

I have a txt file with the full path for .jpg files, I need to xcopy the whole folders including everything inside using xcopy using batch file

我有一个 txt 文件,其中包含 .jpg 文件的完整路径,我需要使用批处理文件使用 xcopy 复制整个文件夹,包括其中的所有内容

回答by Michael

This is an old question, but I had the same question and neither of the above answers quite did it for me. I had to add /s:

这是一个古老的问题,但我有同样的问题,上述两个答案都不适合我。我不得不补充/s

xcopy C:\path\to\source\directory D:\path\to\destination\ /e /i /y /s

That copys all files, subfolders, and files in subfolders. More (and helpful) documentation available here:

这将复制所有文件、子文件夹和子文件夹中的文件。此处提供更多(和有用的)文档:

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

回答by ewall

xcopy /?will show you the options you can use. You probably want something like xcopy C:\path\to\source\directory D:\path\to\destination\ /e /i /y

xcopy /?将显示您可以使用的选项。你可能想要类似的东西xcopy C:\path\to\source\directory D:\path\to\destination\ /e /i /y

回答by Dave

Something like this should do it

像这样的事情应该这样做

FOR /F "delims=" %%i IN (c:\temp\paths.txt) DO xcopy "%%i*.jpg" "C:\test\" /s /y