Windows file creation time

File this one under ‘Windows annoyances’. I recently wrote a application that needed to log messages. As a interim solution I created a text file and created logic that would delete it when it was older than 30 days (to keep it from growing indefinitely). The logic to determine it’s age used the file creation time.

Well, that seemed like a good idea at the time. Unfortunately since I was using the same file name before and after the deletion windows didn’t honor the new create time. What happens is this:
Step 1: Create file called MyFile.txt
Step 2: Delete file
Step 3: Create file called MyFile.txt

Note that the creation date is not the date time of the second time MyFile is created, but the first one. So windows remembers that a file with that name already existed and puts the old creation time on the new file.

So much for using file creation time.

Here’s a thread where they discuss this issue:

NOTE: This test was done on a Windows XP machine.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: