Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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: support.microsoft.com/kb/310316 . Unfortunately some of these registry keys no longer work in Vista and upwards. –  Amro Jun 7 '13 at 12:21

13 Answers 13

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.

share|improve this answer

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 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 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 at 18:25

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

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:

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.

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

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

http://lantechsoft.com/data-copy.html

Another one where it can preserve dates while copying files.

http://technocomsolutions.com/data-copy-tool.html

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
1  
How does zipping the copy fit into this discussion? –  Scott Aug 19 '13 at 20:01

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

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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