Page 1 of 1

copy doc files

Posted: 27 May 2021 11:38
by mike99
hello

i want to write code for batch files xcopy all doc files from c: d: drives and subfolders to folder x on usb
and make the names of files short not the same of orginal files

what is the best code in this case

thank you

Re: copy doc files

Posted: 31 May 2021 13:06
by Lordoa
Hello,

I would use the following

Code: Select all

set folderX=Y:\folderx
for /r "C:\" %i in (*.doc) do xcopy "%i" "%folderX%"
for /r "D:\" %i in (*.doc) do xcopy "%i" "%folderX%"
Perhaps there's a better more efficient way to do this, but I'm not familiar enough with all the copy options.

Lordoa