Explorer Rename Overwrite
When renaming a file in Explorer to a name that already exists, overwrite the existing file instead of being blocked by the "file already exists" prompt.
Author: tria
Changes Explorer's rename behavior so that renaming a file to a name that
already exists overwrites the existing file, instead of producing the
"file already exists" prompt or appending " (2)".
Works by hooking IFileOperation::RenameItem / IFileOperation::RenameItems.
When a rename target collides with an existing file, the existing file is
removed first (to the Recycle Bin by default, or permanently if configured).
Settings
- disposition: Where the overwritten file goes —
recycle (safer, default),
keep (renamed in place, see keepInPlaceSuffix), or permanent
(irreversible).
- onlyFiles: If enabled, never overwrite directories, only regular files.
- renameBeforeRecycle: When recycling, append a suffix to the overwritten
file's name before sending it to the Recycle Bin. This guarantees that
restoring the file from the bin will not clobber the new file you just
renamed into its place. No effect when disposition is
permanent.
- recycleSuffix: The suffix to insert before the extension
(
report.txt → report_old.txt). If a file with the suffixed name
already exists, a number is appended (report_old (2).txt), matching
Explorer's own collision behavior. Defaults to _old.
- keepInPlaceSuffix: Used when disposition is
keep. The suffix is
appended to the whole filename including its extension, so
report.txt becomes report.txt_old. This intentionally breaks the
file association so the old file is visually distinct and won't be
double-clicked into its old app. Collisions get the same (2), (3)
treatment as the recycle path. Defaults to _old.
Changelog
1.1.2
- Remove the
enabled master switch — disable the mod via Windhawk's own
toggle instead.
- Preserve the existing target's filename casing when renaming it with the
recycle/keep suffix (e.g. renaming
Src.txt over DEST.txt produces
DEST.txt_old, not Dest.txt_old).
- Don't pass
MOVEFILE_REPLACE_EXISTING when moving the collision target
to its suffixed name — the suffixed path is chosen to not exist, and
silently overwriting would defeat the safety of the suffix.
1.1.1
- Fix
keep disposition: notify the shell of the in-place rename so
Explorer's view doesn't transiently show both files with the suffix
until the window is refreshed.
1.1.0
- New
keep disposition: rename the overwritten file in place (default
<name>_old) instead of deleting/recycling it.
- New
keepInPlaceSuffix setting controlling the in-place suffix.
1.0.0
- Initial release: hook
IFileOperation::RenameItem / RenameItems and
clear the destination on collision.
- Settings:
disposition (recycle / permanent), onlyFiles,
renameBeforeRecycle, recycleSuffix.