batch file Copy files with certain extensions from multiple directories into one directory

后端 未结 5 1396
别那么骄傲
别那么骄傲 2020-11-30 19:33

I\'m a newbie, so bear with me...

I am trying to copy all .doc files that I have scattered throughout several subdirectories of one main directory into

5条回答
  •  春和景丽
    2020-11-30 20:18

    In a batch file solution

    for /R c:\source %%f in (*.xml) do copy %%f x:\destination\
    

    The code works as such;

    for each file for in directory c:\source and subdirectories /R that match pattern (\*.xml) put the file name in variable %%f, then for each file do copy file copy %%f to destination x:\\destination\\

    Just tested it here on my Windows XP computer and it worked like a treat for me. But I typed it into command prompt so I used the single %f variable name version, as described in the linked question above.

提交回复
热议问题