|Here is what I am trying to do:|
I need to copy all .log files from all subdirectory's on a server folder to a single directory on a different disk. The issue is this ..\folder1\log1.log and ...\folder2\log1.log have the same file name and cause the batch file to prompt for overwrite. I don’t care if every file gets appended with a random number to make the file names unique. here is what I have:
for /f "delims=" %%a in ('dir c:\*.log /s /b 2^>NUL') do copy "%%a" "d:\stuff2\%random%*.*"
The issue is that this is only getting one random number and is appending every file with the same number. I run into the same issue with duplicate names in the target directory as I did before.
Is there any way to make that random number either change, or increment? Is there a better way to do what I am trying?
Thank you very much!