In short, unfortunately, there is no way to recover the newer versions of your files, unless you still have a copy elsewhere. Your copy command has overwritten your new versions with the old versions.
The copy command copies files from the source (
old.cc in your example) to the destination (
new.cc in your example). If files with the same name exist in the destination (in your case the newer versions), they will be overwritten. By default, the command
cp will not ask if you want the file to be overwritten unless you supply the
-i (--interactive) option, as in `cp -i .
The mistake was that you swapped source and destination. You really wanted to execute
cp new.cc old.cc ("copy new to old") rather than
cp old.cc new.cc.
Data recovery - As outlined here, there are ways to recover deleted information. As a matter of fact, the copy operation does not physically overwrite your information on the disk because of the way
cp works on an ext formatted file system. That means that the bits and bytes of your new versions may still be somewhere on your hard disk. However, if you attempt do it yourself, it will be a huge challenge to recover these bytes to files that will have a random name, then manually inspect all of your possibly thousand reconstructed files to determine for each file if the file is still usable and what it represents. If you give it to a specialized data recovery service, it will cost a lot.