Question

Locked

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:

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.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| 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

Back to Networks Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums