Skip to content

WoongyuChoi/OverwriteExisting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

OverwriteExisting

Shell Platform License GitHub release (latest by date)

Tiny Windows batch utility that overwrites only the files that already exist in the destination folder — without copying new files.
Useful for “patching” an existing folder with updated versions from another folder.

Overview

OverwriteExisting is a lightweight Windows .bat script built on top of robocopy:

  • Overwrite only existing files in DEST (B) using files from SRC (A)
  • No new files are added to DEST (source-only files are excluded)
  • Prints detailed copy output to the console and writes a log file next to the script
  • Works well with paths containing spaces and Korean characters

How it works (core idea)

The script runs robocopy with options that effectively mean:

  • Copy from SRCDEST
  • Exclude “source-only” items so DEST does not get new files (/XL)
  • Force overwrite behavior for same/tweaked files (/IS /IT)
  • Log to console + file (/TEE /UNILOG)

Download

Usage

  1. Put overwrite_existing.bat anywhere you like.
  2. Run it and input paths:
overwrite_existing.bat

Example

  • DEST (B): D:\destination
  • SRC (A): D:\source

The script will overwrite only the files that already exist in D:\destination.

Example Output (shortened)

==================================================
overwrite_existing (robocopy)
Log: D:\overwrite_existing_20260126_152409.log.txt
==================================================

DEST: [D:\destination]
SRC : [D:\source]

---- Running robocopy (overwrite ONLY existing files in DEST) ----
...
ROBOCOPY exit code: 1
Status: OK

Log saved to: D:\overwrite_existing_20260126_152409.log.txt

Robocopy exit code note
robocopy uses bitmask exit codes. Typically 0–7 are OK, and 8+ indicates failures.

Notes

Dry run (preview without copying)

If you want to preview what would be copied, add /L to the robocopy line:

robocopy "%SRC%" "%DEST%" *.* /XL /IS /IT /L ...

Subfolders (recursive)

If you want to include subfolders, add /E to the robocopy line:

robocopy "%SRC%" "%DEST%" *.* /E /XL /IS /IT ...

Requirements

  • Windows with robocopy available (Windows Vista and later, including Windows 10/11)

License

This project is licensed under the MIT License.
See the LICENSE file for details.

About

Overwrite-only sync for Windows: update existing destination files from a source folder without copying new files (robocopy-based).

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages