5

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.

  • On Stack Overflow: Move folder between drives on NTFS and preserve timestamps. (Though closed as off-topic, its answers would be appropriate here.) – DavidRR Dec 23 '16 at 16:25
  • @amn ... Do you still need a solution to this, because I believe I have one I can write up as an answer but would need to test a bit. It is a PowerShell solution but let me know if interested as I think I could help you get an answer that works and you might even be able to accept. Let me know and I'll be happy to help you get a working solution in place. – Pimp Juice IT Aug 8 at 13:35
  • Appreciate your offer, but it was a sporadic use case, and I can't even recall why it was so important for me to preserve folder timestamps. I wish I could squeeze some more utility out of this question and its answers, but I just can't offer you much more than what's already written. You might still want to invest in a good answer -- there may be others who will benefit from it. – amn Aug 8 at 14:56
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.

| improve this answer | |
  • Interesting, thanks. I tried "sending" the folder to a "compressed archive" using ZIP support that is built in to Windows 10, but some of my files have unicode characters in their names, so the process aborted on me with an error. I'll try using WinZIP and see where I end up. – amn Mar 18 '16 at 11:15
  • What error did you get? Just wondering how you know it's because of the Unicode characters? Another factor could also be how long your file names are? It may also be an idea to try making a compressed file of one folder at a time, in case the issue causing the error was a disc read error due to bad blocks or sectors. Also, if WinZIP doesn't work then definitely try creating a disc image file. It may be worth your while reading this summary of disc formats: msdn.microsoft.com/en-us/library/windows/desktop/… – Monomeeth Mar 18 '16 at 11:36
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).

| improve this answer | |
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.

| improve this answer | |
  • 1
    What command are you talking about?  Please do not respond in comments; edit your answer to make it clearer and more complete. – Scott Jun 20 '19 at 4:39
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.

| improve this answer | |
0

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

| improve this answer | |
  • SafeCopy doesn’t copy to network shares, only local disks – Victor Guzman Aug 10 at 4:43
-1
cmd>robocopy from to /dcopy:dat

// preserves folder timestamps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.