How Can I Copy Files and Preserve Date Timestamps?

The date modified and date created timestamps are commonly used to sort files and folders in File Explorer. Sometimes it’s much easier to find a file because we know we were working on it yesterday, rather than having to scroll down a list and find it by name.

This method of organizing files is all very well and good until a file or folder is moved or copied to a new drive. If this is done using File Explorer, timestamps on folders will be updated to the time of the copy or move operation, rendering it more difficult to track files by their last modified date. In this Ask the Admin, I’ll show you how to copy or move files and folders while preserving their timestamps.

Using Robocopy to Copy or Move Files

Robocopy is the Swiss Army knife of file copy tools. It’s built into Windows 8.1 and Server 2012 R2 and provides a robust way to manage, back up, and copy files. Advanced features include the ability to log operations, restart failed copies, and improve performance using multiple threads.

Log on to Windows 8.1 or Server 2012 R2 with an account that has full access to both the source and destination paths for the copy operation.

  • Open a command prompt by switching to the Start screen, type cmd and press Enter.
  • In the command prompt window, type robocopy /? and press Enter. You’ll see there are many parameters that can be specified to provide for almost any file copy/move problem that you need to solve.

All we need to do is provide a source and destination path for the operation and specify two parameters to make sure subfolders and timestamps are included.

  • In the command prompt window, type robocopy c:\finance\ d:\finance\ /mir /dcopy:t and press Enter, replacing c:\finance\ with the path of the folder you want to copy, and d:\finance\ with the path to the destination.
Copying files using Robocopy
Copying files using Robocopy

The /mir switch mirrors the contents of the source folder to the destination folder. This switch should be used with care, as any file/folders deleted from the source folder will also be deleted from the destination folder if run for a second time. /dcopy:t copies the folder and file timestamps.

Once the operation is complete, you should see that any folders and files copied to the destination folder retain their original date created and modified timestamps. If you had performed the same operation manually using the GUI, files would have retained their date modified timestamps and lost their date created timestamps; and folder timestamps would have been updated to the current date and time.