# ROBOCOPY protocoll shows unexplained error



## lampe73 (Nov 1, 2009)

I try to get familiar with robocopy. Before using it on valuable date I did some testing.
The command

robocopy "E:\Temp1" "E:\Temp2" /e /purge (or "/mir")

results in having identical files in Temp2 and Temp1 as desired.
If now I delete one of the ( 4 mp3) files in Temp1 the same command again does its correct duty. However there is an "error".
Here is the protocoll:


C:\Users\BenutzerFritz>robocopy "E:\Music\Handel" "Z:\Handel" /e /purge

-------------------------------------------------------------------------------
ROBOCOPY :: Robustes Dateikopieren für Windows
-------------------------------------------------------------------------------

Gestartet: Montag, 25. Januar 2016 18:37:17
Quelle : E:\Music\Handel\
Ziel : Z:\Handel\

Dateien : *.*

Optionen: *.* /S /E /DCOPYA /COPYAT /PURGE /R:1000000 /W:30

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

4 E:\Music\Handel\
*EXTRA Datei 27.3 m 04 Handel, Wassermusik Suite Nr1 F-Dur - Kopie.mp3
100% Neuer 11.8 m 01 Handel, Concerto grosso C-Dur HWV 318.mp3
100% Neuer 3.7 m 02 Handel, Suite B-Dur Menuet HWV 434.mp3
100% Neuer 9.3 m 03 Handel, Wassermusik 5 Saetze.mp3
100% Neuer 27.3 m 04 Handel, Wassermusik Suite Nr1 F-Dur.mp3

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

Insgesamt KopiertÜbersprungenKeine Übereinstimmung FEHLER Extras
Verzeich.: 1 0 1 0 0 0
Dateien: 4 4 0 0 0 1
Bytes: 52.33 m 52.33 m 0 0 0 27.34 m
Zeiten: 0:00:22 0:00:22 0:00:00 0:00:00


Geschwindigkeit: 2464304 Bytes/Sek.
Geschwindigkeit: 141.008 Megabytes/Min.
Beendet: Montag, 25. Januar 2016 18:37:39
C:\Users\BenutzerFritz>

Question 1: What is the error="FEHLER" here?

Question 2: Robocopy takes much more time than I would assume to find out that the files in Temp2 are identical to those in Temp2 in name, date/time, and size and that one file is missing. It essentially should just need the time for deleting the missing file. What does robocopy do more to consume several seconds for such an easy job?

Question3: For my applycation the comparison of name, data/time and size would be sufficient to declare two files as identical. Are there robocopy options for this modest definition which accelerate the command execution?


----------



## foxidrive (Oct 20, 2012)

If you use this for all commands, is the error still present? My German isn't too crash hot. 


```
robocopy "E:\Temp1" "E:\Temp2" /mir
```
using /e /purge copies all files again.


----------



## lampe73 (Nov 1, 2009)

robocopy "E:\Temp1" "E:\Temp2" /mir 

produces the same unquieting message.


----------



## foxidrive (Oct 20, 2012)

Was it swift the second time?


----------



## lampe73 (Nov 1, 2009)

Same speed. In the meantime I have used robocopy on a 4 GB directory with subdirectories. The process takes about 30 min. Only a couple of files were new or renamed. Every file which is no longer in the source directory is registered as a "FEHLER". But the files in the target directories are ok. I suggest to give up explanation and wait until the files show flaws. Perhaps "FEHLER" is a wrong translation of "missing"? "to be missing" is "fehlen" in german. FEHLER is not far from "fehlen".


----------



## foxidrive (Oct 20, 2012)

lampe73 said:


> Same speed. In the meantime I have used robocopy on a 4 GB directory with subdirectories. The process takes about 30 min.


If you use /mir alone to copy this 4 GB folder, and delete a file in the source folder and use the same command again, it will be 'instantaneous' (only taking as long as needed to parse the folders).

If it's taking another 30 minutes then you are doing things that you haven't told us.

I think you're right about that 'missing' term in German being a mistaken translation.


----------



## lampe73 (Nov 1, 2009)

What I have not told you assuming that it's irrelevant:
The target is a USB stick connected to my Fritz!Box router. The source PC is connected to the router via LAN.
Here is the relevant part of the bat file for the 75 MB directory "Wagner":

:: EASYSTART file://E:/Music/VLC-Stream-Aufnahmen/VLC-Stick-Sicherung/ROBOCOPY.bat
robocopy "E:\Music\VLC-Stream-Aufnahmen\VLC-Stick-Sicherung\Wagner" "Z:\Wagner" /mir

I use the first line to start execution by double clicking. Without anything to change the execution takes 35 s. 
The USB stick is visible as drive Z:\ on the source PC.


----------



## lampe73 (Nov 1, 2009)

For comparison I have connected the USB stick directly to the computer. Now its 'instantaneous'. The connection seems to be very relevant.


----------



## foxidrive (Oct 20, 2012)

Ok. The number of files is also a large factor on slower media.
Flash media is far slower than a hard drive - you could add a USB hard drive and it should be quicker, or an SSD. Oh, and the router is a slower CPU doing the processing so that is a factor.

The first line has :: at the start so it's not running in the batch script.
But yes, you've found the reason for that issue.


----------



## lampe73 (Nov 1, 2009)

Thanks for your valuable advice! The first line is irritating but very practical. It is a comment line but it perfectly functions as a start "command" by double clicking on it. I start all my cmd files that way. After editing and saving the file it is the easiest way to start it.


----------



## foxidrive (Oct 20, 2012)

lampe73 said:


> It is a comment line but it perfectly functions as a start "command" by double clicking on it.


Oh - I can't find out what program provides that function using that EASYSTART keyword....

```
:: EASYSTART file://
```
It occurs to me also, that the network bandwidth is involved too. Is it a gigabit LAN speed?


----------



## lampe73 (Nov 1, 2009)

EASYSTART is no keyword. It could also be "LAZY EXECUTION" or "GO" or amything else. The line is just a regular comment line in a cmd file. But if you write a hyperlink into it - at least in notepad++ - the link links. 
>>Is it a gigabit LAN speed?<< I don'T know. How can I find that out?


----------



## foxidrive (Oct 20, 2012)

lampe73 said:


> at least in notepad++


Yes, that is the key. It is a notepad++ function.

The LAN network card information is in google for your motherboard model - and in Device manager under Network Devices will have some information if you can trawl through it.


----------



## lampe73 (Nov 1, 2009)

It is a Windows 10 PC with Mainboard AS Rock Z77Pro4-M and (according to my search engine) a PCIE Gigabit LAN card.


----------



## Squashman (Apr 4, 2003)

lampe73 said:


> :: EASYSTART file://E:/Music/VLC-Stream-Aufnahmen/VLC-Stick-Sicherung/ROBOCOPY.bat
> robocopy "E:\Music\VLC-Stream-Aufnahmen\VLC-Stick-Sicherung\Wagner" "Z:\Wagner" /mir


Did you actually name your batch file Robocopy?


----------



## lampe73 (Nov 1, 2009)

Yes, why not?


----------



## Squashman (Apr 4, 2003)

lampe73 said:


> Yes, why not?


Well, what do you think this code will do?

```
@echo off
echo.%1 %2 %3
robocopy "E:\temp" "C:\temp" /mir
```
When a batch file has to execute an external command, the first place it looks for the command is in the current working directory.
robocopy matches robocopy.bat in the current directory so you end up in an infinite loop of it trying to execute robocopy.bat and not robocopy.exe. It does not know the difference between robocopy.bat or robocopy.exe unless your provide the file extension to the executable.


----------



## Squashman (Apr 4, 2003)

foxidrive said:


> If it's taking another 30 minutes then you are doing things that you haven't told us.


I agree. I run Robocopy on drives that have 700 Gigabytes and they don't even come close to taking 30 minutes and that is on our network drives.


----------



## lampe73 (Nov 1, 2009)

When I plug the USB stick into my PC directly the copy process takes much less time, it works almost instantaneously, no reason to complain. That is what I will do in the future. The router is in the next room.

I use(d) :: as a substitute of REM. But in the bat file discussed here I found out that :: generates some messages ("The system cannot find the drive") which are not valid and have no consequences. But they are annoying. So now all :: are replaced by REM again and there are no longer phantom errors.


----------



## Squashman (Apr 4, 2003)

lampe73 said:


> I use(d) :: as a substitute of REM. But in the bat file discussed here I found out that :: generates some messages ("The system cannot find the drive") which are not valid and have no consequences. But they are annoying. So now all :: are replaced by REM again and there are no longer phantom errors.


Yes. If you are inside a CODE block when using the IF or FOR commands you will definitely get errors trying to use a double colon as a comment.


----------



## foxidrive (Oct 20, 2012)

Gigabit is good - you could try a USB HDD to see if it improves the response time.

Squashman noticed the name of your script and using the name of a command causes so many people a problem, because they have no idea why their script fails. It's only because you're executing it from a different folder that it works for you.


----------



## lampe73 (Nov 1, 2009)

I have renamed "ROBOCOPY.bat" to "ROBOTCOPY.bat" for the reasons you explained above. It's clear, hygienic, and safe. 

Quote by Squashman >>When a batch file has to execute an external command, the first place it looks for the command is in the current working directory.<< 
What is the difference between a batch file's external and internal command?


----------



## foxidrive (Oct 20, 2012)

This may help you - I am not quite clear on what you are asking:

http://ss64.com/nt/syntax-internal.html


----------

