This is my robocopy line:
robocopy "\\network\Document\Migration" D:\Migration /S
As described here robocopy should skip files that have the same size, date and name.
First copy from network to local folder
When I execute the robocopy line the first time all my test files are copied and this is the result:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : 25 July 2022 13:47:35
Source = \\network\Document\Migration\
Dest : d:\Migration\
Files : *.*
Options : *.* /S /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
New Dir 3 \\network\Document\Migration\
New File 0 file 1.txt
New File 0 file 2.txt
New File 0 File 3.docx
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 1 0 0 0 0
Files : 3 3 0 0 0 0
Bytes : 0 0 0 0 0 0
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Second copy from network to local folder
Now if I execute the exact same command again without touching the files, the 3 files should be skipped, right? But thats not whats happening. All are copied again and "*EXTRA File" is displayed (only relevant infos this time):
------------------------------------------------------------------------------
3 \\network\Document\Migration\
*EXTRA File 0 file 1.txt
*EXTRA File 0 file 2.txt
*EXTRA File 0 File 3.docx
New File 0 file 1.txt
New File 0 file 2.txt
New File 0 File 3.docx
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 1 0 0 0
Files : 3 3 0 0 0 3
Bytes : 0 0 0 0 0 0
First copy from local folder to other local folder
Before writing this Question, I tested the command on 2 local folders with the previous target folder where the 3 test files were copied into as source path and a new target path:
------------------------------------------------------------------------------
New Dir 3 d:\Migration\
New File 0 file 1.txt
New File 0 file 2.txt
New File 0 File 3.docx
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 1 0 0 0 0
Files : 3 3 0 0 0 0
Bytes : 0 0 0 0 0 0
The 3 files were copied as expected.
Second copy from local to local
When executing this script a second time, this is the full result:
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : 25 July 2022 14:49:13
Source : d:\Migration\
Dest : d:\Migration2\
Files : *.*
Options : *.* /S /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
3 d:\Migration\
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 1 0 0 0
Files : 3 0 3 0 0 0
Bytes : 0 0 0 0 0 0
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Ended : 25 July 2022 14:49:13
As expected, all 3 files were skipped. Why weren't they skipped when I copied them from the Network folder?
They all have the same name, date and size:
Edit file comparison and /FFT
As suggested by @Paul I added the /FFT
switch but they are still recognized and copied as *EXTRA File
.
This is the result:
Options : *.* /FFT /V /S /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
3 \\network\Document\Migration\
*EXTRA File 0 file 1.txt
*EXTRA File 0 file 2.txt
*EXTRA File 0 File 3.docx
New File 0 file 1.txt
New File 0 file 2.txt
New File 0 File 3.docx
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 1 0 0 0
Files : 3 3 0 0 0 3
Bytes : 0 0 0 0 0 0
Times : 0:00:00 0:00:00 0:00:00 0:00:00
File comparison
With fc I compared file contents but for all 3 of them "no differences encountered"
C:\Users\username>fc "\\network\Document\Migration\file 1.txt" "d:\migration\file 1.txt"
Comparing files \\NETWORK\DOCUMENT\MIGRATION\FILE 1.TXT and D:\MIGRATION\FILE 1.TXT
FC: no differences encountered
And with robocopy (from here) I only displayed the file metadata and name:
robocopy "\\network\Document\Migration" d:\migration /l /ts /nc /ndl /njh /njs /FFT
0 2022/07/25 11:31:55 d:\migration\file 1.txt
0 2022/07/25 11:32:06 d:\migration\file 2.txt
0 2022/07/25 11:32:18 d:\migration\File 3.docx
0 2022/07/25 11:31:55 \\network\Document\Migration\file 1.txt
0 2022/07/25 11:32:06 \\network\Document\Migration\file 2.txt
0 2022/07/25 11:32:18 \\network\Document\Migration\File 3.docx
I can't find a difference! (The time is 2h less than what it displays on my Windows Explorer but it's consistent, so I think this is not a relevant detail). They are clearly considered as different by robocopy and I don't know how to find out the difference or why it does see them as not similar.
When I do the same command on my two local folders robocopy d:\migration d:\migration2 /l /ts /nc /ndl /njh /njs
no result is coming and this is good because there is not the switch /is
which stands for "Includes the same files.".
Even without the /is
, it displays all file infos on the network / local folder command. They are not the same for robocopy... but why?
Edit - /mir
at the end
So as suggested I executed the following command without /is
to make sure only files that would be copied are displayed and not all.
robocopy "\\network\Document\Migration" d:\migration /l /ts /nc /ndl /njh /njs /FFT /mir
This is the result:
0 2022/07/25 11:31:55 d:\migration\file 1.txt
0 2022/07/25 11:32:06 d:\migration\file 2.txt
0 2022/07/25 11:32:18 d:\migration\File 3.docx
0 2022/07/25 11:31:55 \\network\Document\Migration\file 1.txt
0 2022/07/25 11:32:06 \\network\Document\Migration\file 2.txt
0 2022/07/25 11:32:18 \\network\Document\Migration\File 3.docx
It's exactly the same as without /fft
or /mir
.
/fft
, and add/mir
to the end of the command./copy:DT /dcopy:DT
to exclude copying attributes. If this doesn't work, maybe you should consider a third-party sync product.