Windows – How to copy a directory on Windows, preserving timestamps of all directories being copied

file-transferrobocopywindowsxcopy

I want to copy a directory tree while preserving timestamps of any file and directory descendant that is being copied.

The source directory is on a data DVD (ISO-9660 filesystem). I am copying to an NTFS partition. Copying with Windows Explorer, I see that all folders and files copied have their timestamps set to date and time when the copy operation took place. This is unsatisfactory to me. I want to copy not just file data but also timestamps of regular files and directories.

I googled a bit and recalled using both xcopy and robocopy so I tried both like the following:

robocopy E:\projects C:\Users\me\projects foobar /E /DCOPY:T
xcopy E:\projects C:\Users\me\projects foobar /E /F /K

Robocopy worked for a while and then told me this, interestingly enough:

2016/03/17 20:33:43 ERROR 87 (0x00000057) Time-Stamping Destination Directory c:\Users\me\projects\foobar\baz\mew\
The parameter is incorrect.
Waiting 30 seconds...

Xcopy does not seem to preserve timestamps for subdirectories it copies, and there is no way to tell it to.

I also tried RichCopy from Microsoft TechNet which was touted as all kinds of improvement over Robocopy, and it does not preserve timestamps of directories either and has no options to switch that on.

I have no problems preserving timestamps of files, mind you. All three programs mentioned can do that. Except Explorer, the first thing I tried, but no surprises there, really.

I am on Windows 10 64-bit.

What other program or method can I try to get the kind of behavior I want?

P.S. I also tried Total Commander, because someone on Stack Overflow said it preserves directory timestamps. It doesn't, not for me at least. Also SyncBack could not do it.

Best Answer

Make a compressed archive of the data, such as a .zip file. You should then be able to copy that .zip file to any drive and decompress it. All the folders and files should then appear with all their original attributes.

Another option is to make a disk image of the disc and copy that to any drive you want. Whenever you need to view the data just open the disc image up. All your file attributes should be preserved.