Robocopy /MIR leaves shortcut in destination

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
falcios
Posts: 43
Joined: 02 Mar 2017 05:38

Robocopy /MIR leaves shortcut in destination

#1 Post by falcios » 25 Apr 2017 04:53

After running Robocopy /MIR /np /tee, I ran WINDIFF to compare both directories.

On the top level destination there's a shortcut to an external drive, that is not on the source.

Why is this happening? I thought Robocopy does a complete replica of the source.
Is there a switch I need to include on the command line?

Thanks in advance.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Robocopy /MIR leaves shortcut in destination

#2 Post by penpen » 25 Apr 2017 09:09

Your description of the issue is much too vague (at least in my eyes), or in other words it is as precise as:
findstr /r /s /i finds the line "abc def" (without doublequotes) it should not find.

My guess is:
Your source directory is the root level of a logical volume (example: Z:) on a subdirectory (ex: \a\b\) on a physical volume (E:) of an external drive (ex: USB-Stick xyz), possibly created using subst.exe:
subst Z: "E:\a\b".

If my guess is right, then "Z:\.." should be listable with dir (using: dir "Z:\").
Note that "Z:\.." is a symbolic link realised using a shortcut to the external root of "Z:" (== "E:\a\b") to avoid changing to "E:\a", if you use a command like "cd .." on "Z:\".


If i guessed wrong, then you should really provide a full working (anonymized) example, and describe all possibly needed additional information in detail.

For example at minimum something like that:

Code: Select all

@echo off
:: my system: Windows 10, 32 bit, german, all patches installed with no problems
set "actual=<actual path>"
set "source=<source path>"
set "target=<target path>"

:: creating source example
pushd "%source%"
md "a1"
md "a2"
md "a2\b1"
md "a2\b2"
md "a2\b3"
:: ...

>"a2\f2.txt" echo("a2\f2"
>"a3\b2\f32.txt" echo("a3\b2\f32.txt"
>"a3\b2\f32.txt" echo("a3\b2\f32.txt"
:: ...
popd

:: complete robocopy command

WinDiff results:

Code: Select all

...

If your example does not work on a single harddisk in your own local system, then you should also give additional information, for example:
"Z:" is created with subst.exe (subst z: "D:\á\b\c\d"),
"D" is a network drive located on a linux xyz machine, located in logical partition on SATAII hard disk drive accessed.
... .

penpen

Post Reply