I am not sure exactly why this was needed, but the idea was find the files created or authored by this user and then copy them from sourceA to sourceB. When the copy was done, it was also not to be modified in terms of date/time stamps. The code for that was actually easy:
private void CopyFile(string file, string target)The hard part was searching the properties...
{
string targetFile = GetTargetPath(file, target);
Directory.CreateDirectory(Path.GetDirectoryName(targetFile));
File.Copy(file, targetFile, true);
File.SetCreationTime(targetFile, File.GetCreationTime(file));
File.SetLastAccessTime(targetFile, File.GetLastAccessTime(file));
File.SetLastWriteTime(targetFile, File.GetLastWriteTime(file));
File.SetLastAccessTime(targetFile, File.GetLastAccessTime(file));
}
No comments:
Post a Comment