CMD Command to Copy files with certain extension
So I'm using this command to copy only txt files from a certain directory to another di开发者_运维问答rectory
for /R c:\source %%f in (*.xml) do copy %%f x:\destination\
But it only copies over the text files without a space in the name, so it copies test.txt but not test 2.txt. How do I make it so it copies txt files with spaces?
Add quotes just around the variable after the copy command:
for /R c:\source %%f in (*.xml) do copy "%%f" x:\destination\
What's wrong with
copy c:\source\*.xml x:\destination\ >nul
[Edit] Oh I see, you want to copy all the files in all directories recursively, but without copying the directory structure. Nevermind, then.
精彩评论