(No such file or directory) after rename files in commit in target branche

Hello!
Sorry for my English!

There is such a small script that recursively finds the names of the changed files and deploys all this goodness.
There is a problem with the case: when the commit to the target branch contains just one renamed file. In this case, for some reason, the renamed file is accessed, but by the old name, and, of course, we fall with an error (There is no such file or directory) since this file is no longer available by that name!

How can I solve this problem?