Talal Itani wrote:
I need the program I am writing to duplicate a folder, from one drive to
another drive. I need a progress report, and write-verify. What is a good
way to do that? I am using C# express, with XP.
The copy logic:
private void XCopy(string dir1, string dir2)
{
string[] files = Directory.GetFiles(dir1);
foreach (string f in files) {
File.Copy(f, dir2 + f.Substring(dir1.Length), true);
}
string[] dirs = Directory.GetDirectories(dir1);
foreach (string d in dirs) {
XCopy(d, dir2 + d.Substring(dir1.Length));
}
}
For progress report you need to use a ProgressBar (remember
to update via Invoke).
Verification can be added after File.Copy.
Arne