you can get a list of directories (and files) by looking into the Directory class, which lives in the System.IO namespace.
string[] theDirectories = Directory.GetDirectories(path, "*", SearchOptions.AllDirectories);
this will return to you all the directories within the current path, directories and subdirectories.
what you can do then is to do another one and check to see if the "source" path matches, in length (same length/number of dirs found), the destination path. Example:
string[] theSource = Directory.GetDirectories(path, "*", SearchOptions.AllDirectories);
string[] theDestination = Directory.GetDirectories(path, "*", SearchOptions.AllDirectories);
if (theDestination.Length < theSource.Length)
{
//dirs are not the same, copy them over
}
in regards to problems, you will have a problem if the file is opened by another application, so you can use a try catch {} block to catch the IOException and move on whilst copying the files.
This is one solution but hope it gives you a head start!
|