Can some one give me a hint/example of copying a directory in a non-static environment? I tried to look it up but no such luck.
private void copybutton_Click(object sender, EventArgs e)
{
string selectedPath = comboBox1.SelectedItem.ToString();
copydirectories(@"C:MavroMavBridge" + selectedPath, @"C:MavroMavBridge" + selectedPath + " - Copy");
}
public void copydirectories()
{
try
{
string selectedPath = comboBox1.SelectedItem.ToString();
DirectoryInfo source = new DirectoryInfo(@"C:MavroMavBridge" + selectedPath);
DirectoryInfo target = new DirectoryInfo(@"C:MavroMavBridge" + selectedPath);
if (!source.Exists)
return;
if (!target.Exists)
target.Create();
DirectoryInfo[] sourceDirectories = source.GetDirectories();
for(int j = 0; j < sourceDirectories.Length; ++j)
{
copydirectories(sourceDirectories[j].FullName,target.FullName +"\" + sourceDirectories[j].Name);
}
datemodified.Refresh();
}
这只能得出2个论点错误。