I'm trying a very simple batch script, but I must be missing something obvious. The idea is to copy all files from a source folder and from its subfolders to one destination folder. Both source and destination folder can be set manually.
The code below works, but it only copies the files of the source folder and not the files from the source subfolders. I guess it's because I use the src variable that it only looks into that folder, and not its subfolders.
set /p src=Enter source folder:
set /p dst=Enter destination folder:
md %dst%
for /r %%i in (%src%) do copy "%%i" %dst%
pause
I based it on the code below that I found on this forum. This one working, including copying the subfolders, but as I mentioned before, I can't define the (main) source folder, or I have to put the batch script in the folder I want to use as source folder:
for /r %%i in (*) do copy "%%i" %dst%
Thanks a lot!