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 | Übersetzung Deutsch |🔔 | Comments:0

sleep or wait in batch files: pause cmd | Windows Batch | Execute remote commands with psexec pstools - cmd Windows

Top articles in this section

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:

Execute remote commands with psexec pstools - cmd Windows

The pstools can be used to execute commands on other computers: Of course, this requires the necessary rights for the remote connection: by default, these are the domain administrator or the local administrator. As an alternative for a remote connection to another computer, PowerShell remoting can also be used, see: Powershell Remote

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:

Questions / Comments