Robocopy example - server relocation

Even in times of Windows PowerShell there are certain commands that still do not have a worthy successor in Windows PowerShell. One of these commands is undoubtedly the good old robocopy command.

With Robocopy it is possible to transfer or synchronize certain folders. Robocopy takes over all permissions if the right parameters are used, which makes Robocopy suitable for use in file server relocation. In addition, the copying process can be logged in a text file and checked afterwards.

The following command transfers all files of a source folder to a destination folder:

c:\windows\system32\robocopy.exe \\sourceserver\d$\Ordner e:\targetserver /e /mir /NP /tee /ZB /COPYALL /r:1 /w:1 /MT:32 /log+:c:\log\sync.txt

The files are transferred to the destination folder completely including permissions. If the data is synchronous after the first run, the command can be started again to transfer only the changes, including the deletions that have taken place in the meantime in the source folder.

As mentioned above, Windows PowerShell is not yet able to compete with Robocopy in terms of performance and the system resources it requires for the simple purpose of synchronizing folders.


positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Publication: 2022-12-12 from Bernhard 🔔

Top articles in this section

sleep or wait in batch files: pause cmd
The function wait or sleep was not available in BATch files by default.Remedy is a small detour via the ping Command

Structure of a batch file Syntax: echo off cmd
If you have created a batch file, you can write a command in each line, see: how to create a batch file - basics. The commands are executed in sequence when the file is started. The behavior of the output can be adjusted as follows:

Practical examples with batch
Handling variables in Windows Batch (command prompt) Read all variables Variables can be read out in the command prompt with the set command:

Questions / Comments