Tell me more ×
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
What timestamp should robocopy use if you don't specify the T flag? – AbqBill Mar 4 at 23:13
@AbqBill - The assumption would be the current system timestamp. – dbenham Mar 4 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 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 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 at 2:52
show 2 more comments

migrated from stackoverflow.com Mar 5 at 1:21

1 Answer

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

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.