File Creation Time
-
I have situation in code where I have to deal with the File Creation Time. I have used System.IO.File class to check for the existence of the File and then deleted it, then in another function created the File using FileStream Class with FileMode.Create and CreateNew Parameter. File is delete in both cases from disk, (as it shows in the folder - with FileInfo and System.IO.File) but when the File is created again with FileMode.Create and FileMode.CreateNew, it has the older creation date i.e. the date of the deleted file. Can anyone help on this with a thorough and solid answer?
Muhammad Talha
-
I have situation in code where I have to deal with the File Creation Time. I have used System.IO.File class to check for the existence of the File and then deleted it, then in another function created the File using FileStream Class with FileMode.Create and CreateNew Parameter. File is delete in both cases from disk, (as it shows in the folder - with FileInfo and System.IO.File) but when the File is created again with FileMode.Create and FileMode.CreateNew, it has the older creation date i.e. the date of the deleted file. Can anyone help on this with a thorough and solid answer?
Muhammad Talha
Well, it seems strange that it would keep the old date/time but i'm sure there's a reason. Until you find out why, you can set the creation time yourself. Sadly, i can't remember where exactly you do that, you may need to do a bit of googling.
My current favourite word is: Waffle Cheese is still good though.
-
I have situation in code where I have to deal with the File Creation Time. I have used System.IO.File class to check for the existence of the File and then deleted it, then in another function created the File using FileStream Class with FileMode.Create and CreateNew Parameter. File is delete in both cases from disk, (as it shows in the folder - with FileInfo and System.IO.File) but when the File is created again with FileMode.Create and FileMode.CreateNew, it has the older creation date i.e. the date of the deleted file. Can anyone help on this with a thorough and solid answer?
Muhammad Talha
Take a look at this: http://www.devcity.net/Articles/133/1/article.aspx[^]
Regards, Rob Philpott.