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.

Robocopy Copy Flags?

I just recently made an answer here http://stackoverflow.com/a/15211788/891976 where I suggested using robocopy and its /copy flags, but for some as of yet unknown reason, the /copy flags are being ignored.

This was originally noted by dbenham, but I too have confirmed that when I specified the /copy:DA flag, robocopy just ignored it and did a full DAT copy.

Robocopy Documentation

Script

@echo off
robocopy Tools Tolls /COPY:DA /S /IS
pause >nul

Output

------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows

------------------------------------------------------------------------------

  Started : Mon Mar 04 16:59:43 2013

   Source : C:\Users\Username\Desktop\Tools\
     Dest : C:\Users\Username\Desktop\Tolls\

    Files : *.*

  Options : *.* /S /COPY:DAT /IS /R:1000000 /W:30

------------------------------------------------------------------------------

          New Dir          5    C:\Users\Username\Desktop\Tools\
100%        New File                 825        Connect.bat
100%        New File                 424        DevSpec.bat
100%        New File                 215        Disconnect.bat
100%        New File               69599        Shortcuts.zip
100%        New File              28.8 m        Tools.zip

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         1         0         0         0         0
   Files :         5         5         0         0         0         0
   Bytes :   28.87 m   28.87 m         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00


   Speed :           150632582 Bytes/sec.
   Speed :            8619.265 MegaBytes/min.

   Ended : Mon Mar 04 16:59:43 2013

Anyone have insight into why the /copy flag did not work?

share|improve this question

migrated from stackoverflow.com Mar 5 '13 at 1:21

This question came from our site for professional and enthusiast programmers.

    
What timestamp should robocopy use if you don't specify the T flag? –  AbqBill Mar 4 '13 at 23:13
    
@AbqBill - The assumption would be the current system timestamp. –  dbenham Mar 4 '13 at 23:16
    
@AbqBill I am just making an assumption since the functionality appears to be undocumented, but if you do not copy the time stamps, then it would seem to make sense to use the current time. However, I am unable to even verify this since it is ignoring my /copy flags. –  David Ruhmann Mar 4 '13 at 23:17
    
I don't know the answer, but my guess is that it assumes T if you specify A or D. Experiment and see. –  AbqBill Mar 4 '13 at 23:23
1  
@AbqBill Side-Effect or not it is undocumented behavior since the documentation gives all indication that this is a valid use case. Therefore, it could also be classified as a bug in design. For it supports a DA option for the DCOPY but not the COPY. That is a very inconsistent implementation, that has a need to be documented. –  David Ruhmann Mar 5 '13 at 2:52

2 Answers 2

up vote 1 down vote accepted

Undocumented Behavior

Well it would appear the undocumented behavior is as follows:

Whenever, the D flag is used for /COPY, robocopy will automatically add the T flag.

However, this does not apply to the directory /DCOPY flag. It can be specified without T and work.

Tested (no files are copied without D, only folders)

/Copy:D becomes /Copy:DT
/Copy:A becomes /DCopy:DA /Copy:A
/Copy:T becomes /DCopy:D /Copy:T
/Copy:DT becomes /DCopy:D /Copy:DT
/Copy:AT becomes /DCopy:DA /Copy:AT

Note: tested on Windows 7 64 bit and Windows 8 64 bit.

share|improve this answer
    
How would you specify /DCOPY without including T, and what would it mean? The only (documented) valid option to /DCOPY is T (so only /DCOPY:T). See the Command line reference here: Updated: April 17, 2012. Particularly the D option seems meaningless with /DCOPY... how would (should) the behavior of /DCOPY:DT be different than /DCOPY:T? –  Kevin Fegan May 22 '13 at 11:11
    
...Well it would appear the undocumented behavior is as follows... this is documented behavior. See the documentation here: XP010 –  Kevin Fegan May 22 '13 at 11:24
    
I'm curious, Is this document still provided by an official Microsoft source? Also this document is about 17 version / 10 years old. Yet, the behavior is still undocumented in all the current official documentation. –  David Ruhmann May 22 '13 at 21:41
    
'... Is this document still provided by an official Microsoft source?' Yes, while 10 years old, it is the most current full official Microsoft documentation available for Robocopy. It is currently available as Robocopy.doc for XP010 version when you download the current version of Robocopy GUI. (Note: Robocopy GUI includes version XP026 of Robocopy.exe and version XP010 of Robocopy.doc). –  Kevin Fegan May 24 '13 at 6:01

This is by design, and also it is not undocumented.

According to the Robocopy Documentation:

Note: If file Data is copied, then file Timestamps are also copied.

This is from page 6 in this document: XP010


About the XP010 document linked above:

While 10 years old, as of the date of this posting, it is the most current full official Microsoft documentation available for Robocopy. It is currently available as Robocopy.doc for XP010 version when you download the current version of Robocopy GUI from Microsoft website. (Note: Robocopy GUI includes version XP026 of Robocopy.exe and version XP010 of Robocopy.doc).

As of the date of this posting, no (printed or electronic/downloadable) full official Microsoft documentation is available for Robocopy version XP026 or XP027.

share|improve this answer
    
Interesting, So the only mention of it is in a document from 2003 for version XP010. But it is undocumented in all current official documentation. Windows 7 Version = XP027. –  David Ruhmann May 22 '13 at 21:35
    
'...this document is about 17 version old...' actually 2 versions old. After XP010 was version XP026 then XP027. The document I linked, while 10 years old, is the most current full official Microsoft documentation available for Robocopy. –  Kevin Fegan May 24 '13 at 1:10
    
Again, Interesting. The only place where this document was released was through a TechNet blog (November 2006) with the release of a tool "RoboCopy GUI" (Abandonware). And incorrect, that document is not the most current full official Microsoft documentation. This is: technet.microsoft.com/en-us/library/cc733145.aspx or this robocopy /?. Also note that this tool is not by the official robocopy owners but a MSN Search group worker. –  David Ruhmann May 24 '13 at 17:07

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.