Question
After moving a file to another location, and then creating a file with the same name in the original location, the creation time is incorrect
My code:
//Move the file to another location
File.Move(@"D:\Test.log", @"D:\LogHistory\" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".log");
//Create the file with the same name again in the original location,the time the file was created is not the time the code was executed.
StreamWriter _writer = new StreamWriter(@"D:\Test.log", true);
_writer.Close();
As shown above, I want to move a log file to a history folder and then create another log file with the same name in the same location, but the new log file is created at a time other than the current time.
Can anyone explain why? Is this phenomenon related to the file system?