Robocopy: How to quickly copy files and folders on the local network

2430

Two words about the built-in Windows utility allow you to quickly copy files and folders from one system to another. With Robocopy, it is also possible to enable synchronization.

We have often talked about the possibility of using Robocopy to backup files and folders. Professionals and companies that have not yet adopted centralized backup tools can take advantage of the Robocopy utility to quickly copy any file within the local network, for example, to a NAS server. The important thing is that the target device uses versioning; that is, it can keep multiple versions of the same files stored. This way, you can undo the latest changes made to a file and “go back in time”.

In the same article, we saw how it is possible to use Robocopy to copy files and folders from one system to another and synchronize data. The advantage is that Robocopy is integrated into Windows and is therefore immediately usable.

To quickly copy files and folders on the local network, you just need to note the name of the device in use. To do so, just press the Windows + R key combination, then type sysdm.cpl and read what is reported next to the item Full computer name.

Robocopy: how to quickly copy files and folders on the local network - Image 1

Alternatively, to read the PC name, just open the command prompt and type ping localhost. The device name will appear in plain sight to the right of Ping.

From another PC connected to the local network, you can use the following syntax to copy all the files and folders in the SOURCE folder.

robocopy C: \ SOURCE \\ PC-NAME \ DESTINATION_FOLDER / S / E / Z / ZB / R: 5 / W: 5 / TBD / NP / V / MT: 16 Variables can also be used

instead of C: \ SOURCE environment file as % userprofile% to refer to the currently used user profile folder.

For example, typing the following will copy all the contents of the Documents folder of the user account in use to the SERVER01 system connected to the local network :

robocopy% userprofile% \ Documents \\ SERVER-01 \ BACKUP / S / E / Z / ZB / R: 5 / W: 5 / TBD / NP / V / MT: 16

The destination folder (in this case \ BACKUP ) may or may not exist, but you must still have the necessary permissions to access and save files.

Robocopy: how to quickly copy files and folders on the local network - Image 2

Instead of \ BACKUP, on the shared folder (provided you have the necessary permissions), you can specify the name of a new folder that does not exist on the target system.
Beware of copying folders containing hidden system files .INI: if you use the.ShellClassInfo

directive inside them, you will find folders that appear in File Explorer in a certain way and from the command prompt in another. In other words, the name in File Explorer may be different from what it appears at the file system level.

If you want to view the contents of such a folder from the command prompt, you will need to open it with administrative rights (type cmd in the Windows search box then press CTRL + SHIFT + ENTER ), access the folder that contains the directory with the files copied from Robocopy and type rd FOLDERNAME / s / q.

It is possible to have the local system read from a shared folder on the local network. For example, the following command will copy the files contained in the SOURCE folder on the SERVER-01 system and save them in the local folder % userprofile% \ Documents \ backup (usually C: \ Users \ Documents \ backup).

robocopy \\ SERVER-01 \ SOURCE% userprofile% \ Documents \ backup / S / E / Z / ZB / R: 5 / W: 5 / TBD / NP / V / MT: 16

Perhaps the most important parameter is / MT because it allows Robocopy to use multiple threads for file copy operations. Instead of copying files one at a time, as with File Explorer, that is, with standard interface commands, you can have Robocopy handle multiple file copy operations at the same time. The default setting is eight threads (in the example, we have specified 16), but it is possible to go up to 128 even if it is not recommended due to the greater demands in machine resources and bandwidth.