strange file creation date...

Posted on 2004-11-04
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
    LVL 17

    Expert Comment

    by:Wim ten Brink
    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

    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

    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

    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

    > 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 :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now