Question : Copy all files in one directory

I have a complex structure of directories, subdirectories, subsubdirectories and files.
I need a simple opearion - to copy ALL files from ALL (sub)(subsub)directories  in one single directory.
What is the easiest way to do it?
Thank you.

Answer : Copy all files in one directory

You could do the following. Set the srcDir and destDir environment variables:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
@echo off
 
setlocal
 
set srcDir=c:\rootDir
set destDir=d:\singleDir
 
pushd "%srcDir%"
 
for /f "tokens=*" %%a in ('dir /b /s /a-d 2^>NUL') do copy "%%a" "%destDir%"
 
popd
Open in New Window Select All
Random Solutions  
 
programming4us programming4us