How to copy a file on network folders?

By SanKulPune ·
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:


The folders contain multiple folders:

Comp 1:


Comp 2:


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.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Don't need a nested for loop, I'd think.

by seanferd In reply to How to copy a file on net ...

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

Collapse -

Seanferd's right

by neilb@uk In reply to How to copy a file on net ...

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

Collapse -

Re. How to copy a file on network folders?

by SanKulPune In reply to Seanferd's right

Thanks for both the responses.

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

- Sanjay Kulkarni

Related Discussions

Related Forums