Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
possible duplicate of How to copy files while not modifying the file creation times at all? – John T May 27 '10 at 23:20
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
This may be of interest: . Unfortunately some of these registry keys no longer work in Vista and upwards. – Amro Jun 7 '13 at 12:21
robocopy c:\folderA c:\folderB /mir /it is all you need. Note that this will completely delete c:\folderB and create a new c:\folderB that mirrors c:\folderA. – Pacerier May 4 at 3:54

13 Answers 13

up vote 4 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

Just using the windows explorer it's not possible. If you look at the documentation for CopyFile ( 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.

share|improve this answer
Link is broken. – Smile4ever Jan 2 at 7:41

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.

share|improve this answer
In Windows robocopy is the recommended way to do this since it not only copies file/folder attributes but also allows for proper file integrity and error handling during the entire copy process. – megamorf Jan 1 '14 at 11:15
@megamorf: In what way does robocopy do anything special? It doesn't do any checksumming or hashing of the data, it relies on the OS to report errors just like almost any other program. – afrazier Jan 1 '14 at 17:44
I agree that as of now robocopy has no pre-post checksum comparison feature. But in general, robocopy will retransmit the entire file when an error occurs. If you want it to resume writing the rest of a file to the destination after an error occurred without transmitting the entire file again you specify the /Z switch. – megamorf Jan 1 '14 at 18:25
@afrazier, Why not simply use /mir? – Pacerier May 4 at 3:54
@Pacerier, because the question isn't about mirroring a tree, it's about copying files and folders and preserving as much metadata as possible. Not only does /mir remove data from the destination folder, you still needed the /dcopy:t to preserve directory mtimes and /copyall to preserve more than just the file timestamps. – afrazier May 4 at 13:29

... 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.

share|improve this answer
Cool idea. But does this copy over "the other stuff" like file properties and etc etc? – Pacerier May 4 at 2:36

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

share|improve this answer

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:

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

share|improve this answer
File download utilities (like Bittorrent) allocate the full size of the file on disk (filled with 0), and download sections from multiple sources, storing them in the right place in the file. The files when started will have many 0000. Either the file was never completely downloaded or Synchronize It! saw too many 0000 and gave up the copy. – Chloe Mar 1 '13 at 19:18
Thanks! I used Synchronize It! It's so fast too! SyncToy and Unison were messing up the file modification times. Unison was corrupting Cygwin symlinks. SyncToy was even copying 'My Music' which turned out to be in a junction on the destination, but when I refreshed, it kept wanting to copy over again, even though everything was the same! – Chloe Mar 2 '13 at 7:32

It's simple to move folders and directories and still preserving Creation Date. Just hold Shift and drag the folder to the new location (move command). Date Modified will be the present date but Date Created will retain the original date.

share|improve this answer
xcopy *.* C:\temp\Pics /c /d /e /h /i /k /q /r /s /x /y

I am not sure which switch maintains the file date but this works. Then I zip the C:\temp\Pics directory which also maintains file dates as mentioned earlier.

share|improve this answer
How does zipping the copy fit into this discussion? – Scott Aug 19 '13 at 20:01
It fits by also maintaining timestamps for the [zipped] files, something that seems to occupy the person who asked the question. You're welcome, Scott. This happens to make for a useful answer, if not the correct one. – amn Aug 20 '15 at 16:31

FastCopy can do this and it is free.

share|improve this answer

Simple way to move folders and preserving Creation Date & Time use these utilities

Another one where it can preserve dates while copying files.

share|improve this answer

xcopy works fine for this. Just specify the /k flag to copy attributes.

xcopy Source [Destination][Optional parameters]

The xcopy command can copy one or more files or directory trees from one location to another. The xcopy command is included in all versions of Windows from Windows 95 to Windows 8.

share|improve this answer
I just tried the /K parameter and it did not preserve the creation dates. – CoDEmanX Jan 4 at 18:30

I achieve this with

rsync -avu --modify-window=3602 source_directory/ target_directory/

(this is really used as a syncing tool from one directory to another mirror and the timewindow option is to prevent issues when windows systems move clocks 1 hour for daylight savings etc. compared to linux systems)

in either cygwin environment inside windows or a linux virtual machine inside windows with windows drives mounted (e.g. with virtualbox)

NB cygwin and virtualbox are both free and enable you to have to a lesser or greater extent linux functionality on windows - they both require a bit of setting up - particularly virtualbox, but have many benenfits....

My own issue was that files have the correct time but directories did not. rsync has sorted out the dates on the directories as well as the dates on the files.

share|improve this answer

i have discovered that the simplest way for me so far is the "send to" method. without the need of any external applications. in my experience it retains all of the original file attributes. the method i used before was the compression/zip folder method. though this is surely to take longer since the files are not only copied but processed and compressed, both when compressing and decompressing.

%appdata%\Microsoft\Windows\SendTo or C:\Users_______\AppData\Roaming\Microsoft\Windows\SendTo

add a shortcut to the folder where you want them copied and the item will appear in your sendto menu when you right-click a file you want to copy

share|improve this answer

This command copies the same time stamp for files. Note it doesn't do exactly the same time stamping for the folders themselves. Also note that I placed quotes around both source (Temp1) and destination (Temp2). This is done in case there are spaces in the paths. I don't have any spaces but I thought I should include it for worst case scenarios.

robocopy /E /copy:DAT "C:\Temp1" "c:\Temp2"

To keep timestamps the same for folders as well:

robocopy /E /copy:DAT /dcopy:DAT "C:\Temp1" "c:\Temp2"

share|improve this answer

You must log in to answer this question.

protected by Community Jan 25 '15 at 23:17

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .