On Linux, we can simply do:

cp -pr directory

How to do that in Windows? Can it be done in Windows Explorer? Any GUI tool suggestions?

It would be the best if I can keep the NTFS permissions and creation/modification/access time. At a minimum, I need to preserve the modification date for the files and the directories. Windows Explorer's copy does not preserve the modification date for directories.

link|improve this question

62% accept rate
I don't think it's a duplicate. File creation time is only one of the file attributes. – netvope May 28 '10 at 1:01
The answers in that question provide software which will preserve all timestamps, mtime, ctime, and atime. – John T May 28 '10 at 1:11
feedback

5 Answers

up vote 2 down vote accepted

There's no simple way to do this in windows. There are serveral programs which claim to be able to preserve the creation date of files.
Here's a few programs which might do the trick http://forum.soft32.com/windows/preserve-creation-date-Copy-ftopict361820.html

Just using the windows explorer it's not possible. If you look at the documentation for CopyFile (http://msdn.microsoft.com/en-us/library/aa363851%28VS.85%29.aspx) you will see it says:
This article should document semantics with respect to file creation/modification/access times.

Creation time: if the target file already exists, its' creation time is preserved, otherwise it is set to the current system time.
Last Modification time: always copied from modification time of the source file.
Last Access time: always set to the current system time.

link|improve this answer
feedback

RoboCopy can preserve the mtime for directories with the /DCOPY:T switch, but this only works in Vista and newer. It can also preserve ACLs. Alternatively, FastCopy can be configured to preserve directory mtimes, ACLs, and ADSes.

link|improve this answer
feedback

Synchronize It! 3.5 keeps all timestamps (files and folders, modification and creation). It's the only software I know on Windows XP which does that flawlessly, beside Robocopy, and I've tried many. Beware, though, it can produce corrupted files with source files downloaded using software like FlashGet or Orbit Downloader (the resulting files have the same size but only 25kB is actually copied - the rest is filled with zeros). I asked the creator of the software if he could figure out why, but he had no clue; I guess it has to do with such software downloading files in small packets (intended to optimize speed) and my data partition being hugely fragmented.

Robocopy XP026 is indeed included in Windows Vista, but works on Windows XP. Search "Robocopy XP026", or I can send the file here as it's not very easy to find. Or you can install Robocopy GUI and then search for the robocopy.exe file in the System32 folder, so as to use it from the command line. The file I have is 208kB and the version number is 5.1.2600.26.

There seems to be a bug with the "backup mode", though:

http://msmvps.com/blogs/martinzugec/archive/2008/03/03/ugly-bug-in-robocopy-ignoring-security-on-file-level.aspx

Robocopy version XP027 apparently no longer has this bug but it doesn't work on Windows XP.

link|improve this answer
feedback

... or you can just make a zip archive (with compression method set to just "Store"), and then unpack the files where you wanted to copy them. The date/time attributes are the same as the original files.

link|improve this answer
feedback

RoboCopy should be able to do it with the COPYALL switch. You can grab the GUI version from Microsoft Technet.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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