I'd like to copy one filetype from sub directories, placing the copies into one folder, renaming them so they don't overwrite. Rename it but keep the file extension. I don't care what it is renamed to, as long as each copy has a unique name so they don't overwrite.
Here is my code now. It does everything I'd like except it overwrites files with same name:
Code:
set dSource=C:\Users\P Ditty\Documents\SH3\data\cfg\Careers
set dTarget=C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR
set fType=*.clg
for /f "delims=" %%f in ('dir /a-d /b /s "%dSource%\%fType%"') do (
copy /v "%%f" "%dTarget%\" 2>nul
)
Thank you.
To avoid the duplicate problem by retaining original directory structure:
set dSource=C:\Users\P Ditty\Documents\SH3\data\cfg\Careers
set dTarget=C:\Users\P Ditty\Documents\SH3\data\cfg\Backups_SCR
set fType=*.clg
xcopy/s/i "%dSource%\%fType%" "%dTarget%"