5
Robocopy Copy Flags?
I just recently made an answer here https://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.
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
@DavidRuhmann, Any way that we can get our hands on the source code or actual workings? – Pacerier – 2015-04-24T17:10:38.257
@Pacerier, There is no available of the robocopy source code that I know about. – David Ruhmann – 2015-04-27T14:32:47.253
What timestamp should robocopy use if you don't specify the T flag? – None – 2013-03-04T23:13:18.167
1@AbqBill - The assumption would be the current system timestamp. – dbenham – 2013-03-04T23:16:54.290
@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 – 2013-03-04T23:17:09.193I don't know the answer, but my guess is that it assumes T if you specify A or D. Experiment and see. – None – 2013-03-04T23:23:34.387
@AbqBill Indeed I am trying many different combinations. So far
/COPY:DT
works,/COPY:A
works, but when I just specify/COPY:D
is automatically appends theT
. So far it appears to make theT
required whenD
is used. I am trying to figure it out, but any insight to the undocumented behavior is appreciated. – David Ruhmann – 2013-03-04T23:26:34.037This may be an implementation side-effect. I'm not sure the author(s) anticipated your use case. If you really need to use the current time after copying, this is pretty easily accomplished using PowerShell. – None – 2013-03-05T01:11:40.907
2@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 theDCOPY
but not theCOPY
. That is a very inconsistent implementation, that has a need to be documented. – David Ruhmann – 2013-03-05T02:52:39.607This behavior is as designed and documented. See my answer below for documentation. – Kevin Fegan – 2013-05-22T11:21:18.460
@KevinFegan This behavior is not documented in an current official documentation. XP010 is 17 version / 10 years old. So should I scour all of Java 1.4 documentation and say that is more correct over the Java 1.7 documentation when I am using version 1.7? – David Ruhmann – 2013-05-22T21:50:10.530