How to Sync Files from One Server to Another with Robocopy

Samuel Bennett

Samuel Bennett

How to Sync Files from One Server to Another with Robocopy

Robocopy (Robust File Copy) is an aging command-line tool that comes preinstalled on MicrosoftWindows servers. It can be used to copy files on Windows and non-windows file systems. 

However, Robocopy suffers from several shortcomings, including:

  • Creating complex or specific sync jobs requires implementing complex command prompts.
  • Because of its limited transfer topology (i.e., point-to-point transfer), and limited tool set, copying using Robocopy to sync large files and copying files to multiple endpoints takes a long time and is error prone.
  • Robocopy will only copy files if the source file and destination file have different timestamps.
  • Robocopy doesn’t support real-time file sync.
  • Errors encountered during the file copy process are both hard to diagnose and can cause the entire sync process to fail.

In this article, we’ll discuss how to synchronize files using Robocopy from one server to another, including the command prompts you can use to create specific file sharing parameters. We’ll also discuss our own file synchronization solution, Resilio Connect, and how creating sync jobs with Resilio is much easier and more reliable.  

Resilio Connect is a P2P (peer-to-peer) file synchronization solution that’s used by leading companies in tech (Match.com, Kaspersky), gaming (Blizzard, Wargaming.com), media (Mixhits Radio, Turner Sports), and more. It delivers the fastest transfer speeds in the industry (10+ Gbps per server), uses UDP-based WAN transfer technology to optimize file transfer across high-latency and lossy networks, and scales organically to easily handle large sync jobs (tested at 250+ million files in a single job) and replication to many endpoints. 

If you’re interested in learning more about Resilio as a Robocopy alternative, please check out this blog.

To learn more about syncing your company’s files with Resilio Connect, schedule a demo.

How to Create a Robocopy Sync Command

Let’s start by breaking down the basic syntax of the robocopy command.

Robocopy C:\[source]  C:\[destination] [sync parameters]

robocopy: Initiates the robocopy command.

C:\[source]: The first folder in the command is always the source folder.

C:\[destination]: The second folder in the command is always the destination folder.

[sync parameters]: This is where you enter commands that govern how your folder sync occurs. The sync parameters don’t need to be in any particular order.

Sync parameter commands include:

/copyall — This command copies all source file information, including file names, security permissions, auditing information, and more.

/s — This command copies subdirectories, excluding empty subdirectories.

/e — This command copies subdirectories, including empty subdirectories.

/z — This command copies files in restartable mode.

/b — This command copies files in backup mode.

/zb — This command uses restartable mode, and switches to backup mode if access is denied.

/PURGE — This command deletes destination files and folders and subfolders that no longer exist in the source.

/mir — This command copies subdirectories (including empty folders) and deletes destination files that no longer exist in the source server. You should be aware that the NTFS permissions for the files in the destination directory tree will also be overwritten.

/Copy:DAT — This command copies file data, attributes, and timestamps.

/Copy:DATSOU — This command copies file data, attributes, timestamps, security information, owner information, and auditing information.

/dcopy — This command copies directory timestamps.

/MT:16 — This command copies files in multithreaded mode — i.e., multiple files are copied simultaneously.

/mov — This command moves files and deletes them from the source directory after they’re copied.

/MAXage:n — This command excludes files older than a certain time/date. Replace n with the time/date you want to exclude.

/R:N — This command specifies the number of retries Robocopy will perform when a file transfer fails. N should be replaced by the desired number.

/W:N — This command specifies the amount of time Robocopy should wait before retrying a sync (in seconds). N should be replaced with the number of seconds you want Robocopy to wait (the default is 30 seconds).

/tee — This command instructs Robocopy to output what it’s doing to the screen display.

/v — This command instructs Robocopy to display verbose output and show skipped files.

/np — This command instructs Robocopy not to display the progress of the copy operation.

The following command prompt represents an example of what an actual robocopy powershell command might look like:

robocopy C:\sourcefolder\sharename C:\destinationfolder\sharename /e /b

The above command will copy all subdirectories, including empty ones, in backup mode.

Four Reasons Why Resilio Connect Is a Superior File Sync Solution

As stated above, while you can use Robocopy to create highly specific sync jobs, doing so requires knowing and implementing complex command prompts.

It’s also not the best tool for large sync jobs (syncing large files and syncing to multiple endpoints can take a long time). And when it breaks down, identifying and troubleshooting replication issues can be difficult — like most free command-line tools, it doesn’t provide a lot of insight into replication jobs.

But Resilio Connect is a real-time, P2P-based file sync solution that is superior to Robocopy in several key ways, including:

  1. Resilio is easy to centrally manage.  All jobs can be easily controlled, tracked, and monitored through a single pane of glass.
  2. Resilio provides real-time, organically scalable synchronization.  Changes to files and folders are automatically and efficiently synchronized to as many other systems as needed. 
  3. Resilio is optimized to transfer files over WAN networks.
  4. Resilio offers superior security features.

Note: For smaller sync jobs, you can also use Resilio Sync. At $7-$14 per user per month, Resilio Sync is perfect for:

  • Individuals who want to sync files from a personal computer to another computer or remote device can use Resilio Sync.
  • Small businesses that need to sync files for collaboration among geographically distributed teams.

1. Creating, Managing, and Automating Sync Jobs with Resilio Is Much Easier

Deploying Resilio Connect and creating synchronization jobs (no matter how complex or specific) is much easier than Robocopy, as Resilio was designed to be easy to use and manage.

Resilio can be easily deployed on your existing infrastructure and begin replicating in as little as 2 hours. It’s an agent-based software that’s more flexible than Robocopy — it can be set up in the cloud, on-prem, or in a hybrid cloud model. Resilio supports a variety of cloud storage services, virtual cloud servers, mobile devices (Resilio offers iOS and Android apps), and desktops. And Resilio can be configured cross-platform on a variety of file servers, including Windows, Ubuntu, Linux, Unix, iOS, MacOS, Android, and more.

Resilio's Management Console.

Managing sync jobs with Resilio is easy with Resilio’s Management Console, which provides insight into the state of replication via real-time notifications and detailed transfer logs. You can also use it to sync jobs and parameters that suit your needs, such as:

  • Adjusting replication parameters. Configure buffer size and disk I/O threads, create bandwidth usage policies on each server (including creating profiles that govern how much bandwidth each server can use at specific times of the day or days of the week), and more.
  • Setting up Webhooks.
  • Configuring user permissions.
  • Allocating bandwidth.  It’s easy to centrally control how much bandwidth each job can utilize, and change the policy as needed over time.

Monitoring replication and troubleshooting replication issues is easy with Resilio, as Resilio provides detailed information on replication jobs.

The dashboard provides detailed transfer logs and real-time notifications.

Resilio also gives you all of the automation capabilities that Robocopy provides without any of the complexity, enabling you to easily automate any type of scripting or functionality using the GUI, REST API, and command-line prompts.

Overview of job summaries.

2. Real-Time, Organically Scalable Synchronization

Because of its point-to-point topology, Robocopy is slower, less reliable, and less scalable than Resilio Connect.

With point-to-point replication, files can only be transferred to one server at a time (i.e., from one server to another). This transfer methodology is slow (especially when syncing large files and/or syncing to multiple endpoints) and can create bottlenecks. If one server is on a slow network (or file transfer is impeded by some other issue), every other server must wait for that file transfer to complete before they can receive their files.

But Resilio uses real-time file change detection, P2P transfer, and file chunking to deliver fast (up to 10 Gbps per endpoint), reliable file synchronization.

Resilio can detect and immediately replicate file changes using real-time notifications from the host OS and optimized checksum calculations — i.e., it assigns an identification marker to each file that changes whenever a change is made to the file.

And each server in your replication environment is equally privileged and can share files with any other server. This means that there is no single point of failure — if the network is slow or goes down on any server, the necessary files or servers can be provided by any other server.

Resilio also uses a process known as file chunking, where a file is split into several chunks that can transfer independently from each other. With file chunking and Resilio’s P2P transfer topology, file transfer can occur simultaneously across all of the servers in your environment, resulting in transfer speeds that are 3-10x faster than point-to-point solutions.

For example, when replicating a file from Server 1 to the other servers in your environment, Server 1 can split that file into six chunks. Then it can share the first chunk with Server 2 (or any other server). When Server 2 receives the first chunk, it can begin sharing it with Server 3 before it has received the full file.

P2P vs Client-Server architecture.

Innovative Design is a creative print and media marketing agency that uses Resilio to collaborate on projects and sync files across 3 offices.

“We were able to turn around graphic proofs quicker based on our staff’s availability versus forcing it through a bottleneck at a specific office. Connect has made us more efficient.”

Learn more about how Innovative Design syncs over 800,000 files across locations and transfers, consolidates, and restores 4.5TB of data.

3. Superior WAN Transfer

Most point-to-point replication solutions like Robocopy aren’t optimized for copying or synchronizing files across the WAN.  For basic WAN transfers, they rely on TCP, which performs poorly over WANs.

But Resilio optimizes transfer over lossy, high-latency WAN networks using a proprietary UDP-based WAN acceleration protocol known as Zero Gravity Transport™ (ZGT).

ZGT uses several methods to optimize WAN transfer, such as:

  • Calculating the ideal send rate via a congestion control algorithm.
  • Sending interval acknowledgements for a group of packets (that contains information about packet loss), rather than for each individual packet.
  • Retransmitting lost packets just once per RTT (Round Trip Time).

Because of Resilio’s WAN optimization technology, it can also sync and transfer files from the edge of the network — i.e., to and from remote locations with poor internet connections. Our client Shifo, for example, uses Resilio to sync files to poor, remote areas in Uganda and other locations.

Shifo is a health data solution company that delivers life saving healthcare solutions to remote communities and uses Resilio Connect to quickly deliver files to over 3,000 remote locations with poor quality networks. 

“Resilio Connect reliably runs in the background — and just works. Like a humble, dependable friend… We sleep better because Resilio is there. That’s a critical piece. You can’t imagine how difficult it was for us (prior to Resilio): Delays, nothing being synchronized; now I don’t hear any of those problems. Now we can focus on solving healthcare problems (instead of moving files).” 

Learn more about how Resilio delivers reliable file distribution for Shifo across any network connection.

4. Superior Security Features

Robocopy doesn’t encrypt your data at rest or in transit, leaving it vulnerable to interception and malicious activity.

But Resilio uses 3rd-party reviewed, state-of-the art security features to protect your data. It encrypts data at rest and in transit using AES 256 and one-time session encryption keys. And it uses mutual authentication to ensure files are only delivered to secure, approved endpoints and cryptographic integrity validation to ensure files arrive at their destination intact and uncorrupted.

Use Resilio Connect for Fast, Reliable Server Synchronization

While Robocopy can be used for server synchronization, setting up and troubleshooting sync jobs can be difficult. You should use an alternative replication solution like Resilio.

Resilio is a superior alternative to Robocopy for file synchronization because it:

  • Uses proven P2P replication topology to sync files faster and in real-time.
  • Is organically scalable with no single point-of-failure.
  • Uses WAN optimization technology when needed to optimize file transfer over any network, including high-latency networks with varying degrees of packet loss.
  • Provides built in security features that protect your data at rest and in transit, and provides encryption end-to-end. 

To learn more about syncing with Resilio Connect, schedule a demo.

Overview

Learn how to use Robocopy to sync file servers and the commands you can use to control how the sync is performed.
Related Posts