Damian
Damian

Reputation: 55

Copying all files from several folders to 1 folder with a batch

I'm trying to copy several files from several folders into 1 folder with this code:

for /R \\wiki\help\images %%f in (*.jpg, *.png, *.gif) do (
    copy %%f "\\10.101.3.21\wikitest\wiki\wikiimages"
)

However, it copies all the files as wikiimages, and I can't get around it. I just want to use the copy command, not an external program (so no xcopy or the like). How can I do this?

Upvotes: 0

Views: 170

Answers (1)

LazyShpee
LazyShpee

Reputation: 82

I'm pretty sure

for /R \wiki\help\images %%f in (*.jpg, *.png, *.gif) do copy %%f "\10.101.3.21\wikitest\wiki\wikiimages\"

is the way to fix this, it usually need the \ to know its a folder and not a filename.

Upvotes: 1

Related Questions