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

7

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.

windows
file-transfer
robocopy
xcopy
asked on Super User Mar 17, 2016 by amn • edited Jan 3, 2017 by amn

6 Answers

6

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.

answered on Super User Mar 17, 2016 by Monomeeth
2

Total Commander preserves directory timestamps, at least for me, but you need to tell it to do that in options dialog first.

Click ConfigurationOptions, select Copy/Delete (under Operation in listbox on the left), tick Copy date/time of directories (in General Copy+Delete options group on the bottom), click OK.

There might be loads of corner cases where it does not preserve timestamps.  For example, it is said to not preserve timestamps when copying between FAT32 and NTFS.  However, simple ISO9660->NTFS works just fine – just as extracting zip/7z archives.

Also please note that creation timestamp is not preserved.

According to How can I preserve my files' create dates, after copying and pasting to another drive? (on CNET Forums), there is a tool named SafeCopy V2 that could preserve creation timestamp; however, I've never used this myself (Last modified timestamp suffices for me, as it is that timestamp shown by default in Total Commander).

answered on Super User Oct 22, 2018 by Krzyś • edited Oct 22, 2018 by Scott
1

SafeCopy truly copies all files and folders, including the date and time. It is free too! https://www.elwinsoft.com/safecopy-free.html

answered on Super User Jul 25, 2020 by Rick Shaddock
0

In my testing the date modified was changed on folders when the /move parameter was added to the command. If the /move exists, then the folder date modified timestamp becomes the time of the copy. If the /move does not exist, then the folder data modified timestamp is not changed when copied.

answered on Super User Jun 19, 2019 by briceybrit
0

Use the backup function in a tool called xyplorer. Basically when you "backup" a directory of files from drive to another drive, it preserves timestamps for files and directories.

answered on Super User Dec 19, 2019 by djrichard
-1
cmd>robocopy from to /dcopy:dat

// preserves folder timestamps.

answered on Super User Oct 10, 2020 by user1227808 • edited Oct 10, 2020 by user1227808

User contributions licensed under CC BY-SA 3.0