Search code examples
visual-studioxcopypost-build-event

XCOPY copy file but not overwrite


I'm using XCOPY in a post-build event to copy some files to the bin directory. However, I don't want to overwrite when the file is already up to date. How can I do that?

sample:

echo F | xcopy /y "$(ProjectDir)..\Files\MyFile.ini" "$(TargetDir)"

Solution

  • "Use the /d option, xcopy will skip the copy if the target file is up to date". Answer from comments.