This will frankly not be reliable.Every time I update I always delete the previous folders and upload the new ones. Also how do I redownload an older version?
Especially if you are using the admincp to run the update steps, and even the CLI installer will not work in all cases.
If you really want to prune dead files, upload the new files; run the installer; then delete the files and reupload the new ones.