当我使用此代码时,它不会引发任何错误,但它仍然不会复制任何内容。有任何想法吗?。
//string spath = string.Format("S:\\ 0A36303 / user:admin");
DateTime theDate = dateTimePicker1.Value.Date;
DirectoryInfo Dir = new DirectoryInfo("S:");
string dircreate = string.Format(@"N:\{0:MM-dd-yyyy}\" + label1.Text + "LogFiles", dateTimePicker1.Value.Date, label1.Text);
DirectoryInfo target = new DirectoryInfo(dircreate);
FileInfo[] fis = Dir.GetFiles( ".txt", SearchOption.AllDirectories);
foreach (FileInfo fi in fis)
{
if (fi.LastWriteTime.Date == theDate)
{
File.Copy(fi.FullName, target.FullName + @"\" + fi.Name, true);
}
}
}
}
}