Question Locked

How to copy a file on network folders?

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I (net admin) want to copy a file in multiple folders of each computer on my network using a batch file.

Here is the simplified description of the problem.

Computers C1 and C2

Each has a folder structure:

c:\f1\f2

The folders contain multiple folders:

Comp 1:

U11
U12

Comp 2:

U21
U22

I want to copy a file fil.txt in each of the four U folders.

I believe I can use nested For loop for that but not sure how to figure out that.

Please help.

4 replies

by seanferd

Just for-in-do. Wildcard the "U" subfolders (assuming they have a naming pattern as represented here).

by Member 25348569

You only need a nested FOR loop if you want to do it on one line and that would just be showing off.

:)

For %%i in (C1,C2) do for /D %%j in (\\%%i\C$\f1\f2\u*) do copy sourcepath\fil.txt %%j

by sankulpune

Thanks for both the responses.

I'll give it a try today and come back here again if I have any problem.

- Sanjay Kulkarni

This discussion is closed to new replies.