Nov 18 2014

How to Copy Only New Files and Changed Files With XCopy on Windows

Category: WindowsFatih Acar @ 17:42

If you want to copy only new files or changed files, you can use xcopy command in batch script file on Windows system.

Copy Only New Files and Changed Files With XCopy

set SourceDir=D:\Source
set TargetDir=F:\Target
xcopy %SourceDir% %TargetDir% /i /d /y

/i /d /y parameters provide that copy only new files and changed files. These detect file modify time changes , but do not notice size changes.

197,932 total views, 15 views today

Tags: System Administration, Windows Batch Script, Windows Server

facebook comments:

4 Responses to “How to Copy Only New Files and Changed Files With XCopy on Windows”

  1. Chuck Swenson says:

    This will fail if you have new directories – xcopy ignores them by default. To copy everything, including new directories, you should add the /e switch:
    Also, if you have spaces in your directory names, you need to enclose them in double quotes. So:
    Set SourceDir=”D\My Source\stuff”
    Set TargetDir=”F:\My Backup\stuff”
    xcopy %SourceDir% %TargetDir% /i /d /y /e

  2. 33Lacy says:

    I must say it was hard to find your page in google.
    You write great articles but you should rank your website higher in search engines.
    If you don’t know how to do it search on youtube: how to
    rank a website Marcel’s way

  3. FirstStaci says:

    I have noticed you don’t monetize your blog, don’t
    waste your traffic, you can earn additional bucks every month
    because you’ve got high quality content. If you want to know
    how to make extra $$$, search for: Boorfe’s tips best adsense

  4. Zoks says:

    I found a problem with this /i /d /y switches when destination is on network (\\server\….) , it copy all the time all files instead new and changed ones.
    When destination is on local HD than it works OK, is this some bug?

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.