Reputation: 81
Can anyone help me to solve this problem?
Eg :
FolderA
contains 123.txt
.
FolderB
contains FolderB1, FolderB2, etc.
I want to copy the files from FolderA
to FolderB1, FolderB2, etc.
using batch file.
Upvotes: 0
Views: 1837
Reputation: 4132
Use a for loop to iterate over the target direcories.
FOR /D %%d IN (\Path\to\FolderB\*) DO copy \Path\to\FolderA\123.txt "%%~d"
Upvotes: 1
Reputation: 37569
pushd "\Path\to\folderB"
for /r /d %%a in (*) do cd "%%~fa" & copy "\Path\to\FolderA\123.txt"
popd
Upvotes: 0