Robocopy command: Copy only New / Changed files (Sync both the drive)

robocopy command

Robocopy is a command line tool and available free with the download Windows Resource Kit. It is an external command that is available in the below operating systems.

Windows NT , Windows 2000 , Windows Server 2008 , Windows Vista, Windows 7 & Windows XP.

Download Robocopy Command Line Tool for Windows 2003 and 2008 Server / Windows XP / Vista / 7 from following path:

Install the rktool.exeand follow the following steps to copy new and changed files only.

Start > Run > type cmd and press enter to open command prompt window.

Type robocopy /? to get to know about feature provided by Robocopy command line tool. Here i have marked all the feature with grey color and highlighted some feature which i have used to sync my d: drive to destination drive in which the data has to be copied.

C:\>robocopy /?         // Help for any command

Following command i have used to sync my folders and files.

C:\>robocopy "D:\Folder1" "H:\BackupFolder1"  
/E /ZB /X /PURGE /COPYALL /TEE /LOG:E:\Copy_from_HD_to_Ext_HD.log

Meaning of switches used in above command explained below.

/E :: copy subdirectories, including Empty ones.      

/ZB :: use restartable mode; if access denied use Backup mode.

/COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).

/PURGE :: delete dest files/dirs that no longer exist in source.

/X :: report all eXtra files, not just those selected.

/TEE :: output to console window, as well as the log file.

/LOG:file :: output status to LOG file (overwrite existing log).

Above command will sync your data from source to destination it means if you have deleted some data from your hard drive then it will also remove from destination drive. I have made it to sync my data, if you don’t want to delete any files from destination drive then don’t use /PURGE option.

Some More Examples:

robocopy c:\folder1 c:\folder2 *.txt

In this example all .txt files would be copied from folder1 directory to folder2 directory. 

robocopy c:\folder1 c:\folder2 

In this example all files would be copied from folder1 to folder2 but not directories.

robocopy c\:hope c:\hope2 /e

In this example all files and folders (including empty ones) will be copied from folder1 to folder2 directory.

Copy all the files from source and delete all files from source drive but don’t delete folder.

C:>robocopy "E:\source" "E:\destination" /E /ZB /MOV /COPYALL

ROBOCOPY     ::     Robust File Copy for Windows     ::     Version XP010

Started : Tue May 21 10:17:22 2013

Source : E:source
Dest : E:destination

Files : *.*

Options : *.* /S /E /COPYALL /MOV /ZB /R:1000000 /W:30


3    E:source
100%        New File                1709        Copy from Ext-HD to HD.bat
100%        New File                2711        Copy from HD to Ext-HD.bat
100%        New File                 643        update.bat


Total    Copied   Skipped  Mismatch    FAILED    Extras
Dirs :         1         0         1         0         0         0
Files :         3         3         0         0         0         0
Bytes :     4.9 k     4.9 k         0         0         0         0
Times :   0:00:00   0:00:00                       0:00:00   0:00:00

Speed :               40504 Bytes/sec.
Speed :               2.317 MegaBytes/min.

Ended : Tue May 21 10:17:22 2013


You may also like:

How to install HP LaserJet 1010 driver in Win7

How to get machine serial number, product number using command prompt

160 Run commands for Windows

Get Free Blogging Tips & Technology updates in your Email !!!

Subscribe via RSS feed

The following two tabs change content below.
Anil Kumar
IT Blogger Tips focus on Blogging Tips, SEO Tips, Social Media, SQL Tips, PL/SQL Tips, Oracle DBA, Linux/Unix, Latest Technology, How Tos and Technical Solutions. You can find us on Facebook | Twitter |
Find on Google+

  • Aaditya Singhania

    Obviously RoboCopy is one of the popular software to do the trick. I used it myself for a long time but I felt like it is designed for Linux but patched up to work on Windows which is just a pain to try to get them working, and if they work and break, forget trying to fix them let alone no support. The one program that is similar and allot better than RoboCopy and is best of its kind for windows is GS RichCopy 360 Enterprise. This program works almost the same way except it is DESIGNED for windows and offers a lot more features, it is simple to use and comes with great support. They offer free trial, try it and decide.

  • Anurag Singh

    I have used robocopy and to me a non IT guy it felt like hacking or something. Like they show in movies, typing some commands and then BOOM everything starts to happen. I didn’t felt comfortable using it and at times it started to freeze. My colleagues told me about GS Richcopy 360. It is simple to use and provided me multi threaded file transfer for fast transfer speed, pre scheduled file transfer, email notification when task is done and many more. Try it hope it helps!

Siteground SALE
60% OFF SiteGround WordPress Hosting – $3.95/month (Exclusive Offer !!!)