manipulating list arrays c#

I have a text file comprising two columns, separated by a '/'.
The first column reads the source name and location of a file eg c:\test\test.txt
The second column reads that files intended destination eg E:\test\test.txt
The columns number about 100 items - the second column always aligns with the first (it is derived from the first).
I am trying to write a program that copies the file referred to in the first column to the destination referred to in the second.
I have got the file to read as a list array - but am stumped as how to read each line of the list, copying from the source to the destination.
Does anybody have any experience of this? I have come across 'split' but this does not seem to do what I want - or am I missing something?!

Richard TeasdaleFinancial ControllerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
           String s = "c:\test\test.txt/e:\test\test.txt";
            String[] sSplit = s.Split('/');
            String sLeft = sSplit[0];
            String sRight = sSplit[1];

sLeft is c:\test\test.txt
sRight is e:\test\test.txt

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Asim NazirProject ManagerCommented:

You can read full file line-by-line.
On reading each line you will get Path1/Path2.
At this, you can use split method and this will give you source and target paths.
You can do desired operation at this point and continue this process by reading next line. Let me know if you need some code. I hope this will do.

Richard TeasdaleFinancial ControllerAuthor Commented:
Thanks To you both!
I am  a little stuck on reading the contents of the file to a string ; or converting the String List array to a string. Could you perhaps point me in the right direction?
Then I guess a foreach loop through each line, copying from sLeft to sRight?
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Asim NazirProject ManagerCommented:
Asim NazirProject ManagerCommented:
Updated code from same url:
private void ProcessTxt()
            string filePath = @"c:\Temp.txt";
            string line;

            if (File.Exists(filePath))
                StreamReader file = null;
                    file = new StreamReader(filePath);
                    while ((line = file.ReadLine()) != null)

                        string[] lineData = line.Split("/".ToCharArray());
                    if (file != null)

Open in new window

Richard TeasdaleFinancial ControllerAuthor Commented:
Thanks to you both!
Richard TeasdaleFinancial ControllerAuthor Commented:
Azim: I gave the points before I got your response., basically because AndyAinscrow provided code.
Apologies; had I seen this I would have reversed the allocation. Thank you very much for your help.
Asim NazirProject ManagerCommented:
You can request a split of points :)
But np, thanks anways.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.