What if the new file replaces the old file with the same name?

Probably not. . It can only be a deleted file, and the sector stored in the original file is not covered by other files, so it can be restored by software. Generally speaking, directly replacing sectors stored by file names should also be unchanged, which is equivalent to being overwritten. I don't think I can recover. . But you'd better try. There are many recovery softwares on the Internet. Try one.