问题描述:

Essentially, what I want to do is copy *.txt from the current directory as well as all the subdirectories. If I do xcopy /s /e C:\source C:\dest, it copies not just the files, but the directory structure as well. I need only the files to be copied, so C:\dest contains nothing but *.txt files. I checked the documentation for both xcopy and robocopy, but I couldn't find any parameters that allowed this functionality.

网友答案:

How about using a FOR loop? It'll execute lots of copy commands, but give it a try:

FOR /R C:\source %%f IN (*.txt) DO xcopy /s "%%f" "C:\dest"
相关阅读:
Top