For UNIX/Linux server you can use rsync command to keep data sync’d between two servers. rsync also works under Windows NT/2003 server but it will take lots of time to setup.

For Microsoft Windows 2003 server use robocopy tool, to sync files between two windows server. You can download robocopy.exe and other files from Windows 2003 Resource Kit Tools set.

Once tool is downloaded, install the Resource Kit. By default robocopy located at c:\Program Files\Windows Resource Kits\Tools\robocopy.exe. Now let us assume that you want to sync d:\Inetpub\wwwroot\ directory between two Windows server. First create hidden share on www2 (secondary server)

  1. Login to www2
  2. Select d:\Inetpub\wwwroot\
  3. Right click > Properties > Sharing tab > Share this folder > Add $ at the end of share name and save the changes.

How do I use robocopy command?

=> Login to primary server (www1)
=> Click on stat > run > type cmd
=> At command prompt type command:
c:>"c:\program files\windows resource kits\tools\robocopy.exe d:\inetpub\wwwroot www2\\inetpub\wwwroot\"ALTERNATIVELY, use IP address of www2 server :
c:>"c:\program files\windows resource kits\tools\robocopy.exe d:\inetpub\wwwroot\\inetpub\wwwroot\"robocopy has many more options and lots of other information available in Robocopy.DOC file.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 16 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
16 comments… add one
  • Bala Nov 28, 2006 @ 10:09


    how to post data from one server to another, using asymmetric data transfer.

    Thanks in advance….

  • 🐧 nixCraft Nov 28, 2006 @ 18:52


    I am sorry but i am not getting your question…
    Can you explain it in details?

  • MrCiF Dec 7, 2006 @ 3:42

    Thanks for your posts, nut I have a question:

    I have a RHEL server (running IBM Lotus Domino for email server) and WindowsServer 2003 Std (backup storage server).

    Can you give a help about :

    – step-by-step tutorial about how to backup/restore from Linux svr to Windows svr?

    – step-by-step tutorial about how to keep data sync’d between Linux svr to Windows svr?

    Pls send me a copy to my email if you can!

    Thanks again!

  • Jeffrey Jan 30, 2007 @ 9:50


    is the sync two way ?meaning i have server a and server b in a load balanced environment so i wanna to sync file btw this 2 server..from A to B and also from B to A..Thanks.

  • 🐧 nixCraft Jan 30, 2007 @ 12:47

    Hi Jeffrey,

    Yes you can do both ways. You need to write appropriate batch file.


  • Toyin Ogunmefun Aug 16, 2007 @ 16:20

    I have the same scenario illustrated by jeffrey, do you have a sample of the batch file you mention.Will robocpy connect to a unix/linux server and copy data across to a windows 2003 and keep the data sync.
    I will appreciate if you help with the batch file or point what should be included in it.

  • mmas Mar 28, 2008 @ 17:54

    Any word on getting that batch file?

  • Sunil Jul 7, 2008 @ 14:49

    I found this script in a web site long back.
    There are many new parameters, you can add that from help
    Hope this helps.

    SET prefix=robocopy_backup
    REM This is the file that we're going to backup from our local drive
    SET source_dir=O:
    REM This is the location where the files will be copied to
    REM on the external drive.
    SET dest_dir=E:DropBoxBackup2
    REM Set the log file name based on the current date.  This
    REM will record the results from the robocopy command.
    REM The typical format for the date command is:
    REM Mon 11/09/2000
    REM So, we are parsing the date by moving 4 characters back and
    REM copy 4 characters to get the 4-digit year, then we get the
    REM 2-digit month by moving 10 characters back and copying 2
    REM characters.  Finally, we get the day by moving 7 characters
    REM back and copying 2 characters.
    SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log
    REM See the robocopy documentation for what each command does.
    REM /COPY:DAT :: COPY file data, attributes, and timestamps
    REM /COPYALL :: COPY ALL file info
    REM /B :: copy files in Backup mode.
    REM /MIR :: MIRror a directory tree
    REM /L :: Just list the info, don't actually do it
    SET what_to_copy=/E /COPY:DAT
    REM Exclude some files and directories that include transient data
    REM that doesn't need to be copied.
    SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" "Cookies" "iPod Photo Cache" "MachineKeys"
    SET exclude_files=/XF "*.bak" "*.tmp" "index.dat" "usrclass.dat*" "ntuser.dat*" "*.lock" "*.swp"
    REM Refer to the robocopy documentation for more details.
    REM /R:n :: number of Retries
    REM /W:n :: Wait time between retries
    REM /LOG :: Output log file
    REM /NFL :: No file logging
    REM /NDL :: No dir logging
    SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL
    REM Execute the command based on all of our parameters
    ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options%
  • Report27 Aug 7, 2008 @ 2:36

    Robocopy scripts are good, but I use ViceVersa PRO to sync file between my servers. It is not free, but it won’t fail you!

  • Edwin Jul 4, 2009 @ 19:27

    Thanks for your information.

  • Hemant Sharma Dec 4, 2009 @ 11:29

    How can we synchronize data between two SQL Server Databases using our programmed code.

  • EvaGRrr Oct 28, 2010 @ 13:30

    If you are going to use RoboCopy to Sync folders bi-directionally, you need to be cautious of the default copy behavior (it will copy files which have changed, are newer or older). The example given above is only a one-way sync, as files changed on the destination server would be overwritten on the next copy.

    The /XO option (exclude older source files) should be added so that older files on the source do not overwrite the destination. Then simply reiterate the same command, swapping the source and destination.

  • mirku Aug 28, 2011 @ 15:55

    i’ve found this tool called UNISON, it is UNIX and WINDOWS compatible! the tool is incredible powerfull for synchronizing data.

  • Sathyavrathan PK Sep 14, 2011 @ 11:00

    Any updates to this thread to work with new technologies?
    Better solution for Windows Server 2008 ?

  • ajeet singh Sep 18, 2012 @ 12:11

    i would like to introduce myself, we are US based Company, and having offices in India & NY in current setup we are accessing that server via vertual machines and facing accessing speed problem for that we want to setup a new server in india also and data will sync in both ways, so with this practice we can access servers locally(india & NY), and share the same data from any of both servers.
    i would like to request you please send me the details of your synchronizing software which can run into windows 2003 server & windows xp we want ot buy it but before that we would like to have Demo/Trial copy of that software, and also quotation for the same.

  • EvaGRrr Sep 19, 2012 @ 12:02

    Hi Ajeet,

    I must say that I don’t understand how you’d access a server “via virtual machines”, but there are perhaps other options to avoid setting up a second server. For example using Remote Desktop, or Terminal Services to allow only the screen/mouse/keyboard updates to be transferred.

    If you’re just looking for a 2 server setup, one in India, one in NY with files replicated between the two, then I’d suggest that your best and easiest option is to use Windows Server (if you’re using Windows Server already) and setup DFS and FRS (Distributed File System, File Replication Services). This handles A LOT of things for you behind the scenes like sync times, as well as 2-way sync, which neither RSync nor RoboCopy can do. It is also included in Windows Server… so no additional cost.


Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum