Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

After using robocopy to copy files to a new drive I realized that all the file and directory creation times and been reset to the time of copying.

Are there some switches to make robocopy keep the original files times?

share|improve this question

2 Answers 2

up vote 13 down vote accepted

Take a look at the options for the /COPY:[copyflags] and /DCOPY switches.

As per the ROBOCOPY /? usage info:

/COPY:copyflag[s] :: what to COPY for files (default is /COPY:DAT).
                      (copyflags : D=Data, A=Attributes, T=Timestamps).
                      (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

/DCOPY:T :: COPY Directory Timestamps.

For example:

ROBOCOPY c:\src d:\dest /MIR /COPY:DT /DCOPY:T

Will copy all files and folders and preserve the date and time stamps.

ROBOCOPY c:\src d:\dest /MIR /COPY:DAT /DCOPY:T

Will copy all files and folders and preserve the date & time stamps and file attributes.

There is also another (and I believe deprecated?) switch /TIMFIX which does much the same as /COPY:DT but it doesn't fix the time stamps on folders.

These were tested with ROBOCOPY 5.1.10.1027 on Windows 7 x64 Ultimate.

share|improve this answer

robocopy F:\ E:\ /E /v /S /COPY:DAT /DCOPY:T /R:2 /W:0 /NP > C:\teste\logbackup20141206.txt

To Copy all content from drive F: to drive E: I use the command above.

share|improve this answer
1  
First, this has been answered 4 years ago. Second, this answer leaves much room for improvement. Better explain what those switches do. –  Sven Dec 6 at 21:46

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.