File.Copy Entire Directory to another Directory

I want to copy an entire directory to another destination. I get

Example;

            destination = "C:\jeffrey\"

            strSourcePath = "C:\moves\"
            strDestPath = destination
            File.Copy(strSourcePath, strDestPath)

Error Message;
Could not find a part of the path 'C:\moves\'.

Thanks,
Jeff
jseaman12Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

questionCommented:
is it vb thats used for this.. i use this in a VB application of mine
My.Computer.FileSystem.CopyDirectory(SRCTB.Text, DSTTB2.Text)

SRCTB.Text, DSTTB2.Text are source and destination locations fed dynamically from TEXT box
0

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
Priest04Commented:
from the code I see you are using VB.NET. IF yes, then you can use this method

My.Computer.FileSystem.CopyDirectory(strSourcePath, destination)

if you are using c#, then you would need to do a recursive loop trough each subdirectory and copy all files in them.
0
questionCommented:
Was my idea helpful?
0
questionCommented:
were you able to test my solution?
0
atljarmanCommented:
I found this helpful.  It would be great to see how to loop through and restrict copying of specific files.  For example, if you wanted to copy all files in the directory except those that contained "secure" in the name.
0
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
.NET Programming

From novice to tech pro — start learning today.