Question How do I copy one file in to multiple folders?

IvanWolfhelm

New member
Joined
Jun 1, 2010
Messages
2
Programming Experience
1-3
Hi there

This one has been troubling me for some time :confused:, i keep coming back to it researching it for a couple of days on and off then get disheartened and give up for a while.

Basically i want to copy one file in to multiple folders that have the same structure except for one distinction ... the user name ...

...example...
C:\somefolder\subfolder\User1\destinationfolder
C:\somefolder\subfolder\User2\destinationfolder
...etc...

I have tried using wild cards for the differing folder name but no luck.

Any ideas?

Ever Hopeful,

Alex
 
If there is something specific that can identify as user name then use regular expressions:

Regex.Replace("subject", "regex", "replacement")

Search ".net regular expressions" and you'll find plenty of reference material.

You can assume a certain format in the path e.g. c:\.*\.*\UserName\.*

You can use the first part of your path as a string constant to identify where the user name starts, which is of course delimited by '\' and '\'.
 
Thanks mbb,

This looks a wee bit over my head but i will certainly give it a go, always up for a challenge! TBH it feels good just to have another lead to follow :)

I may be back.

Thanks again.
 
Back
Top