[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


strange file creation date...

Posted on 2004-11-04
Medium Priority
Last Modified: 2010-04-05
Ok, i am looking more for a reason than code for this problem.....

1 - I use the normal assign, rewrite, closefile, commands to create a text file on the hard drive - so far no problem.

2 - I then delete the file via windows explorer and re-run the program again to create the file again. - still no problem.

the creation date and time of the second file is exactly the same as the first file i created AND deleted - problem!

Anyone know what is going on and why it is doing that?

I even used CreateFile to see if it was some oddity with delphi but the same happens.
Question by:foxjax
  • 3
  • 2
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12495173
Windows explorer just kicks the file to the recycle bin. Try emptying the recycle bin before creating the file again. It this solved the "problem" then it's caused because Windows just doesn't delete the file, but just marks it for deletion. Thus, when you create it again, it doesn't create a new file but just empties the old file...
If this doesn't solve this then I'm as stunned as you are. ;-)

Author Comment

ID: 12495476
ok, i tested the solution you gave and it seems to have worked.

Strange that the "problem" does not happen on an NTFS system - it works as i expected.

Do you know of any "down" side of this behaviour i might need to take into account (or "feature" as microsoft would have us call it)?
LVL 17

Accepted Solution

Wim ten Brink earned 500 total points
ID: 12495629
The only down side of this would be that some applications might not notice that a file has changed because they compare the timestamp with a previous timestamp that has been stored in their system. (With Delphi this could mean that a source file that you create dynamically won't be recompiled during a compile because the compiled DCU just contains the timestamp of the original source, which hasn't changed.)

Then again, if this is FAT or FAT32 related then you now have one reason to change to NTFS. ;-)
With FAT(32) you have windows storing folder information in several disk sectors. This FAT table just contains filenames and timestamps and a link to the sectors where the file is actually stored. If a file is deleted, the FAT entry is just marked as deleted. When you create the file again, Windows notices that the file used to be there and perhaps re-uses the FAT entry for this file.

It is a bit mysterious, though...

Author Comment

ID: 12495770
mysterious is one way of putting it - one other "interesting" aspect i have now noticed is that if i create the file via the delphi program then delete it and wait about 3-5 minutes without emptying the recycle bin - and then re-run the program to re-create the file....all works as it is supposed to.

I suspected that perhaps the indexing service was to blame but then realized i had turned it off the first day on installing windows.

kind of makes it a real pain when you're trying to put some decent quality into a program to find that Windows comes up with something odd to mess it all up :(


Author Comment

ID: 12495870
> you now have one reason to change to NTFS

True, but i just did a few more tests on NTFS and it seems to be embedded with the same "feature" too.

Well, thanks for the help.  At least the information is out there for others to read if they get the same "problem" and realize....they are not alone :)

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question