7

With a batch (.bat), I want to copy all mp3 files that are in 1 subdirectory of D:\TEMP

D:\TEMP\\(anyfolder)\\(anyfile.mp3)

to

E:\MYFOLDER\

I tried with xcopy but

  • I don't know how to tell "just recurse subfolders of D:\TEMP and not subsubfolders, subsubsubfolders, etc."

  • When using xcopy, folders are created in the destination (in order to replicate source's folder tree), I don't want this : files should be copied in just 1 single folder.

feetwet
  • 3,248
  • 7
  • 46
  • 84
Basj
  • 41,386
  • 99
  • 383
  • 673
  • Check this method, does not require any batch files or learning any DOS commands- http://www.pcworld.com/article/2105149/gather-similar-files-from-multiple-folders-and-copy-them-in-one-simple-step.html – Swastik Padhi Oct 29 '15 at 09:40

1 Answers1

13

for command is your friend. Read help for and then try this in the command prompt

for /d %a in (*) do @echo %a

as you see, it follows all subfolders in the current directory.

thus,

for /d %a in (*) do @copy %a\*.mp3 e:\myfolder

will copy all your mp3 to the destination folder.

PA.
  • 28,486
  • 9
  • 71
  • 95