I need to copy all files in a folder and it's subfolders to a single folder, without copying the subfolders. From searching stackexchange, I've found this script:
for /f "tokens=*" %a in ('dir /b /s /a-d') do @copy "%a" "c:\Single-Folder"
while it does the job, it does not handle duplicates. You need to manually choose Yes/No. I need to be able to copy all files, either ignoring all duplicates or overwriting all duplicates (it does not matter, whatever is easiest).
I tried this:
for /f "tokens=*" %a in ('dir /b /s /a-d') do @copy /Y "%a" "c:\Single-Folder"
adding the /Y but it then randomly skipped folders - so I think I added this argument in the wrong place.
Thanks.