I have c# application. This write log in folder.
below code.
if (File.Exists(@"C:\EXT_LOG\LOG.txt"))
{
File.Delete(@"C:\EXT_LOG\LOG.txt");
}
string Data = "xxxxx";
System.IO.StreamWriter file = new StreamWriter(@"C:\EXT_LOG\LOG.txt");
file.WriteLine(Data);
file.Dispose();
file.Close();
I delete file, if it exist, and I create file with same name. when I run program, the creation date of file is not change.
I guess windows any manager or any file table still contain that file.
So, when I delete file, can I delete manager or file table content??
This change of the file date ‘Created’ can have the unusal side effect that the new ‘creation date’ of a file is more recent than the ‘modification date’ provided by the system. 2. What File Dates Do We Distinguish? The date taken (year / date / time) is created when a picture is taken or a video recorded.
Right-click the file and press Properties. In the Properties box, press the Details tab, then click the Remove Properties and Personal Information option link. As we’ve mentioned, you can’t remove or change the file creation date or other essential file attributes here.
This generates a file properties window in which you can adjust the creation date of your file and other custom configurations. You have to click on the “File Properties” and make sure the box next to Modify File Date and Time Stamps is checked to alter the formation date on the settings of the Word documents.
Possible reasons are: When copying files, Windows (as other operation systems do as well) modifies the original ‘creation date’ to the date of copying. When setting up a new PC, the date of data transfer to the new hard disk will be set as the new ‘creation date’.
That's how it works in windows. I have not searched Google for WHY. However it seems you can set the creation date of the file through C# using System.IO.File.SetCreationTime method.
public static void SetCreationTime(
string path,
DateTime creationTime
)
Source: https://msdn.microsoft.com/en-us/library/system.io.file.setcreationtime(v=vs.100).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With