Avatar of Chris Lopez
Chris Lopez

asked on 

How To Overwrite Files But Keep Original Files Timestamps

I have one folder "destination" where I have files and their time stamps (created, modified) I would like to preserve when I overwrite a few of those files with updated version of those files.


Destination Folder 
File.mp4- Created 01/01/01 (size 500mb)

Source Folder 
File.nmp4 - Created 12/12/12 (size 4.00gb)

Open in new window

I overwrite the file in the Destination folder with the new updated version from the Source Folder but keeping the original file in the destination folder timestamps

End Result (new overwrite file in the destination folder with original file timestamps)

Destination Folder
File.mp4 - Created 01/01/01 (size 4.00gb)

Open in new window

I have written a batch file to move the file as so

robocopy "Source" "Destination" /E

Open in new window

and this handles my overwrites and moving of my files perfectly, but I haven't found a way to preserves timestamps. I am looking for command-line so I can implement it in a batch file. Any help will be appreciated. I been reading flags for robocopy etc but maybe I'm reading it wrong or something but I haven't figured it out yet.
PowershellWindows BatchMicrosoft DOS* Robocopy

Avatar of undefined
Last Comment
Jose Gabriel Ortega Castro

8/22/2022 - Mon