How do I get Robocopy to only copy the changed files?

Posted on 2005-05-12
Last Modified: 2010-08-05
I am using Robocopy to backup certain files on my computer to my network drive.  It is working fine except it copies files that I have not changed.  If I use the /XN switch then it will not copy changed files.  Out of 1400 files it copies 163 files like .jpg files.  I have also tried the /MIR option but it has erased files on the network.  Here is a copy of my batch file.  Thanks for your help.

Set @W32=C:\Program Files\Lotus\Notes\data\w32

SET @Notes=C:\Program Files\Lotus\Notes

SET @Lotus=C:\Program Files\Lotus\Notes\data

SET @MyShare=c:\Documents and Settings\%username%

ECHO Verifying / Updating Script Software Installation

md p:\(DSR)Backup\%username%\%computername%

c:\DSRBackup\robocopy "%@W32%" p:\(DSR)Backup\%username%\%computername%\Lotus_Notes\W32

c:\DSRBackup\robocopy "%@Notes%" p:\(DSR)Backup\%username%\%computername%\Lotus_Notes


c:\DSRBackup\robocopy "%@Lotus%" p:\(DSR)Backup\%username%\%computername%\Lotus_Notes *.id

desktop6.ndk names.nsf *.dic perweb.nsf perweb*.ntf /zb /r:0 /w:0 /eta /tbd /XO /np


c:\DSRBAckup\robocopy "%@MyShare%" p:\(DSR)Backup\%username%\%computername% /XD applica*

/XD cookies /XD history /XD Local* /XD temp* /XD Nethood /XD Printhoo* /XD Sendto /XD

Recent /XD Start* /XD Templates /XD UserData /XD Windows /zb /e /r:0 /w:0 /eta /tbd /XO /np

Question by:bowmanrn
    LVL 5

    Accepted Solution

    I may be wrong here but Robo copy only copies changed files.  In the begining you have to have syncronization, from there you set the time intervak to check for changed files.  At that point if it sees a changed file, it copies only what it found as changed.

    This might help:
    LVL 82

    Assisted Solution

    robocopy will by default only copy files that are different from the ones in the target directory.
    You might want to have a look at robocopy.doc in the installation directory of the Resource Kit Tools; it explains in detail the different situations that can happen when you copy directory trees.
    Another important thing that might be a potential cause for trouble is that your @MyShare variable is set incorrectly.
    Never, ever, use "c:\Documents and Settings\%username%" to access a users profile; this is *not* necessarily the correct path. Always use "%Userprofile%", which points to the root of the user's profile:
    SET @MyShare=%Userprofile%

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Most of the time we are in fix when all of sudden our systems behave weirdly.  Such problems cost time and effort... so it's best to take some preventive actions so that we can avoid such issues or overcome such problems more easily. Preventive M…
    If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article ( first and run the tool TDSSKiller ( to get rid of the infection. Once done, and if the …
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now