Copy files without overwrite

Robocopy, or “Robust File Copy”, is a command-line directory replication command. It has been available as part of the Windows Resource Kit starting with Windows NT 4.0, and was introduced as a standard feature of Windows Vista, Windows 7 and Windows Server 2008.

   robocopy c:\Sourcepath c:\Destpath /E /XC /XN /XO

To elaborate (using Hydrargyrum, HailGallaxar and Andy Schmidt answers):

  • /E makes Robocopy recursively copy subdirectories,
    including empty ones.
  • /XC excludes existing files with
    the same timestamp, but different
    file sizes. Robocopy normally overwrites those.
  • /XN excludes existing files newer
    than the copy in the destination
    directory. Robocopy normally
    overwrites those.
  • /XO excludes
    existing files older
    than the copy in the destination
    directory. Robocopy normally
    overwrites those.

With the Changed, Older, and Newer classes excluded, Robocopy does exactly what the original poster wants – without needing to load a scripting environment.

References: Technet, Wikipedia
Download from: Microsoft Download Link (Link last verified on Mar 30, 2016)

Leave a Comment