11

I'm having a problem when copying files (or creating new files) on Windows 7. If I copy a file, I expect the date created to be correct, but sometimes it's not. Usually it works, but here is an example of when it doesn't work:

I have two folders on my desktop, folder 1 and folder 2. I create a new text file in folder 1 called 852pm (or whenever it was created). I copy the file to folder 2. The copied file has the correct creation date. I delete the copied file, wait a minute, and copy it again. The creation date is wrong. The creation date is from the deleted file.

I tried emptying the recycle bin first but that doesn't work. And sometimes creating a new file with the same name shows the old creation date (and with a new date modified).

Why does this happen? How can I make new files in this situation show the correct creation dates?

1

2 Answers 2

13

File tunneling

Quoting the official KB article Windows NT Contains File System Tunneling Capabilities:

This occurs after deletion or renaming and re-introducing a new directory entry with that meta-info (if a create or rename occurs to cause a file of that name to appear again in a short period of time).

The idea is to mimic the behavior MS-DOS programs expect when they use the safe save method. They copy the modified data to a temporary file, delete the original and rename the temporary to the original. This should seem to be the original file when complete. Windows performs tunneling on both FAT and NTFS file systems to ensure long/short file names are retained when 16-bit applications perform this safe save operation.

The article also explains how to increase the cache time or disabling the tunneling capabilities altogether.

Disable file tunneling

  1. Press Win+R, type regedit, and then click OK.

  2. Navigate to the following registry key:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
    
  3. Right-click an empty area in the right pane and select New > DWORD (32-bit) Value.

  4. Name the new value MaximumTunnelEntries.
    Make sure it's set to 0: this means no tunnel entries will be created.

Additional information

The name "tunneling" comes from quantum mechanics (pretty cool):

The developer who was responsible for implementing tunneling on Windows 95 got kind of carried away with the quantum mechanics analogy: The fragments of information about recently-deleted or recently-renamed files are kept in data structures called "quarks"."

Source: The apocryphal history of file system tunnelling

Further reading

0

You can update creation time with this command manually:

powershell (ls YourFile.txt).CreationTime = Get-Date

... and the same in a batch file:

call powershell "(ls YourFile.txt).CreationTime = Get-Date"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .