Skip to content

Why a Copied File Can Look Newer Than Its Contents on Windows

Use PowerShell to compare Created and Modified times before and after a Windows file copy, then check whether the two files have the same SHA-256.

By Sourabh7 min read

A file on your Windows drive shows a creation date from today and a modification date from last week. Both can be right. The creation time can describe when this copy appeared on the destination drive. The modified time may have come from the source file.

Think of Created and Modified as answers to two different questions about the file you selected. When did this item appear here? What last-write time does it carry? The lab gives you two files and a known date, so you can see where the answers come from. Then you’ll check the hashes to see whether the bytes match.

Read Created and Modified as Two Separate Times

In PowerShell, CreationTimeUtc reports the creation time the filesystem exposes for the item you are looking at. LastWriteTimeUtc reports that item’s last-write time. File Explorer usually presents these times in local time. Use the UTC properties when comparing machines or when putting different sources on one timeline.

Read Created and Modified as separate fields. This exercise checks both in UTC.

You may see these fields discussed as part of MAC timestamps, which stands for modified, accessed, and created or changed depending on the system and convention. In this lab, we name each Windows property explicitly. NTFS can also record changes to the filesystem record itself. The PowerShell properties in this exercise do not show all of the time fields recovered from raw NTFS records.

In a forensic tool, write down the field name and where it came from. A file’s last-write time, a document’s internal creation date, and an NTFS record-change time can all appear in one report. They can differ because they describe different events or sources. If you compare those numbers, label them before you sort them.

Copy a File With an Older Modified Time

Use an empty practice folder on an NTFS volume, such as the local internal drive on a Windows test machine. Avoid a synced folder so you can focus on the local copy. This command makes a fresh source file and sets its last-write time to a known UTC value. It only changes the new practice file.

powershell
$lab = Join-Path $env:TEMP ('FileTimeLab-' + [guid]::NewGuid())
New-Item -ItemType Directory -Path $lab | Out-Null
$source = Join-Path $lab 'source.txt'
$copy = Join-Path $lab 'copy.txt'
Set-Content -LiteralPath $source -Value 'ForensicSpot file-time exercise'
$knownTime = [DateTimeOffset]::Parse('2024-04-12T09:30:00Z').UtcDateTime
(Get-Item -LiteralPath $source).LastWriteTimeUtc = $knownTime
Start-Sleep -Seconds 3
Copy-Item -LiteralPath $source -Destination $copy
Get-Item -LiteralPath $source,$copy |
    Select-Object Name,CreationTimeUtc,LastWriteTimeUtc |
    Format-List

The source is created when you run the lab. We deliberately set its modified time to April 12, 2024 so the two fields are easy to tell apart. The pause makes it easier to see a difference between the creation times if your copy method creates a fresh destination timestamp.

Illustrative result. Read across each row to compare creation time, then check whether last-write time carried over.

Look at the source first. Its modified time should be the date you assigned. Then compare the destination’s modified time with that value. A common result for a fresh local copy is that this time carries over while the creation time reflects the new copy. The figures give you an example of what to look for. Record your actual result because the copying tool and destination filesystem can change how metadata is handled.

Read the Two Rows in Order

First compare the two values in LastWriteTimeUtc. In the example, both are April 12, 2024 at 09:30 UTC. Then compare the two values in CreationTimeUtc. The destination was created three seconds later in the illustration. The exact interval on your machine will depend on when the copy finishes.

If you see the same last-write value twice, you know what the two items reported at the time you measured them. You do not know when the text was originally written. In the lab you know where the earlier value came from because you set it yourself. In a case, you rarely have that information from the timestamps alone.

If You Get Different Dates

Check that copy.txt did not already exist. The commands use a new folder each time so you can tell a fresh copy from an overwrite. Check the filesystem and the exact tool used. Copy tools can offer switches that preserve timestamps, and a synced or extracted copy can acquire dates through a different process. Also check that you are comparing UTC with UTC.

A comparison with a different tool can help. For example, Robocopy’s /COPY:DAT asks it to copy data, attributes, and timestamps. Try it in a separate subfolder so your first copy stays available for comparison.

powershell
$preserved = Join-Path $lab 'robocopy-test'
robocopy $lab $preserved source.txt /COPY:DAT /R:0 /W:0
Get-Item -LiteralPath (Join-Path $preserved 'source.txt') |
    Select-Object Name,CreationTimeUtc,LastWriteTimeUtc

Robocopy uses its own exit codes. A code from 0 through 7 can indicate a completed run with work done or differences noticed. A code of 8 or higher indicates at least one failure. Review the summary and confirm the actual dates in the output. When working with an existing copy whose history you do not know, use the recorded fields as observations and look for an independent copy or export record.

Check Whether the File Contents Match

Run:

powershell
Get-FileHash -LiteralPath $source,$copy -Algorithm SHA256 |
    Format-List Path,Hash

The hash is calculated from the file’s bytes. For this practice copy, the two full values should match. That lets you separate the observation about the file’s content from the observation about its dates. It is possible to have the same bytes under two files with different timestamps.

Compare both hashes and timestamps. They answer different questions about the copy.

Record the dates before hashing if you also want to discuss last access. A read can affect access metadata under some filesystem settings, and updates can be delayed. Treat access time with care. It can reflect a system process rather than someone choosing to open the file. The file systems lesson covers how NTFS and other filesystems record metadata.

Repeat the Check With One Byte Changed

Make a third file from the destination and change one byte. Leave the source and first copy in place. This gives you a second result to compare, this time with a known change to the contents.

powershell
$changed = Join-Path $lab 'changed.txt'
$bytes = [IO.File]::ReadAllBytes($copy)
$bytes[0] = [byte]($bytes[0] -bxor 1)
[IO.File]::WriteAllBytes($changed, $bytes)
Get-Item -LiteralPath $source,$copy,$changed | Select-Object Name,Length
Get-FileHash -LiteralPath $source,$copy,$changed -Algorithm SHA256 |
    Format-List Path,Hash

The byte count should remain the same. The third hash should differ. The first two files check whether your copying step preserved the bytes. The third checks whether your verification can pick up a change you introduced on purpose. Run all three hashes with the same algorithm.

Compare the full hashes. An exact copy matches the reference. A one-byte change keeps the length and changes the hash.

If you need to repeat this for a study or a review, record the Windows version, filesystem on each side, copy method, and whether the destination existed. Keep the exact commands and both sets of timestamps. A hash from Get-FileHash on a normal file path covers the bytes read from that file. It does not tell you whether permissions, timestamps, or other filesystem data carried over.

Describe the Copy Without Guessing Its History

For the practice test, a useful note reads, “The source and destination have matching SHA-256 hashes. The destination shows a later creation time and the same last-write time as the source.” Use that wording only if your results show it. In a case report, add the exact times, time zone, paths, and copying tool if known. The dates can be consistent with a copy. They do not identify the person who copied it or establish when the document was first written.

If you only received the destination, say that the source was unavailable for comparison. A matching source hash can support a statement about the bytes, but you still need the transfer record, acquisition notes, or another reliable source to say when a handoff happened.

Try writing the note using your two files. If all the dates happen to match, say that and record your copy method. The exercise is about explaining what you measured.

Was this page helpful?