how to copy a file in all of directory and subdirectories?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

how to copy a file in all of directory and subdirectories?

#1 Post by Mohammad_Dos » 31 Aug 2011 07:37

hi there

i want to copy "c:\file.txt" in all of folders in drive D:\

how to do that?
i want to copy it in all of folders. i found a command. but it dont copy the file in folders that have space in their name
Last edited by Mohammad_Dos on 03 Apr 2012 12:48, edited 1 time in total.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: how to copy a file in all of directory and subdirectorie

#2 Post by aGerman » 31 Aug 2011 10:37

Try that:

Code: Select all

for /f "delims=" %%a in ('dir /ad /b /s D:\') do copy "c:\file.txt" "%%a\"

Regards
aGerman

Post Reply