EDIT: Total rewrite of question for clarity.
I have a directory tree (new) with a bunch of files of with an extension of
.new. I have an identical tree (old) where many of the files have names identical to those in the new tree except that the extension is
.old. I would like to copy all of the
.new files from the new directory tree into the old directory tree which contains the
.old files. As a file with a
.new extension is written into the old directory tree, I would like to delete any file with the same name but a
So, if in the new directory tree, there is a file named
new/foo/bar/file.new, it will be copied to the old directory tree as
old/foo/bar/file.new and then the file
old/foo/bar/file.old will be deleted if it exits.
This answer was hashed out below (using the old question that had extraneous background information that was confusing). See the actual solution that I worked out below as one of the answers.