I was debugging some code today and noticed one of my FileInfo objects had its LastWriteTime earlier than its CreationTime time. Is this possible/expected?
I was debugging some code today and noticed one of my FileInfo objects had
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
These properties of the file can be modified to take any value. So there’s absolutely nothing to stop this happening.
That said, the most likely explanation is that the file was copied from one place to another. The creation time will be the time the copy took place. The modification time will be the time the source file was last modified, i.e. before the copy. So, when the file is copied, the modification time is also copied. To see this happen, simply pick a file on your machine. Create a copy of it (CTRL+C, CTRL+V) and look at the properties of the copy.
In other words, it is actually not a contradiction for the creation time to be later than the modification time. The creation time is when this file object was created. The modification time is when the file contents were modified.