Knowledge - Details


Use robocopy to copy files and preserve the timestamps
Date Added: 11/9/2022

If you need to copy a bunch of files in Windows from one folder to another and preserve their original Created and Modified timestamps, here's how:

robocopy C:\source D:\dest /DCOPY:T /COPYALL /E /R:0

/COPYALL: preserve the files' timestamps
/DCOPY:T preserve original directories' timestamps
/E: Copy directories recursively, including empty directories
/R:0: do not retry locked files (the number of retries on failed copies default value is 1 million)

This must be run from a command prompt with admin rights or else it will give a permissions error and fail to start.

During the copy process, you may see the directories have the wrong timestamps, but once each directory's contents are finished copying, robocopy will update the directory's timestamp to match the original before moving to the next directory.



Back to List

Disclaimer: Everything on this website is written for my own use. I disclaim any guarantees that the procedures and advice listed here are accurate, safe, or beneficial for anyone else. If you attempt to follow any procedures or advice shared here, you do it at your own risk. Part of IT work is knowing how to recover from problems.