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?
 
questionConnect With a Mentor Commented:
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
 
Priest04Connect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.