Preserve File Attributes When Copying Files in Windows

file managementwindows

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.

Best Answer

There's no simple way to do this in Windows.  There are several programs that claim to be able to preserve the creation dates of files.
Here are a few programs that might do the trick http://forum.soft32.com/windows/preserve-creation-date-Copy-ftopict361820.html  (Broken link; not in the Wayback Machine).

Using just Windows Explorer it's not possible. If you look at the documentation for CopyFile, CopyFile function (winbase.h), you will see that it avoids the subject.  But CopyFile function (Windows Developer Preview) (a 2012 archive of the same URL) says:

File times semantics

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.

Related Question