Solved Copy multiple files in multiple subfolders to a single fold

August 28, 2012 at 07:41:13
Specs: Windows 7
I am new to writing dos commands, and I am trying to get all of my data in one place (out of multiple subfolders) so that I can rename them all.

How can I correctly use xcopy in command prompt to copy all of the files in the directory (and subdirectories) to another directory. I do not want the subdirectory structure to copy, only the files within them. (There are multiple layers of subdirectories).

Source directory c:\karaoke1 (with many subdirectories and subs underneath them)
Target Directory c:\karaoke_main

I was trying this xcopy c:\karaoke1\*.\*.* c:\karaoke_main

Again, I am very new at this, so your feedback would be GREATLY appreciated. :-)


See More: Copy multiple files in multiple subfolders to a single fold

Report •


#1
August 29, 2012 at 00:47:32
✔ Best Answer
xcopy kind of sucks, imo. most times i try to use it, it has "one tiny flaw" that foils my evil plans. Robocopy is i guess the replacement, but i just fall back to batch for
my own nefarious devices. First, create the directory, then proceed.
::begin script
:: use foll. line if needed or wanted
::md "\karaoke_main"
for /r c:\karaoke1 %%a in (*) do copy %%a \karaoke_main
::end script

(or, from "dos")

md karaoke_main
for /r c:\karaoke1 %a in (*) do copy %a \karaoke_main

:end


Report •

#2
August 29, 2012 at 05:58:30
Thank you so much! I just tried it and it works like a charm!!

Thanks again!


Report •
Related Solutions


Ask Question