iMontoya
iMontoya

Reputation: 11

Coping files from multiple directories into one folder

I have many pictures in multiple directories and want to copy them to one folder, but my script is interrupted when a file with the same name already exists in the destination folder. I tried

for /R d:\dups %f in (*.jpg) do copy "%f" d:\pictures\.

What can i add to the code to append the name of the newer file before it's copied to the the destination folder? My source directory is "d:\dups" and my destination folder is "d:\pictures". thanks!

Upvotes: 1

Views: 131

Answers (1)

Endoro
Endoro

Reputation: 37569

example:

@echo off
for /R "d:\dups" %%f in (*.jpg) do copy "%%f" "d:\pictures\New-%%f"

Upvotes: 3

Related Questions