Committing file deletions with GIT

When you are working with a GIT repo, and you need to delete files, the best way to do that is to use a GIT command directly. You can delete individual files:

git rm that/filename.txt

And you can delete whole folders too:

git rm -rf this/here/folder

But what to do when an automated process deletes file for you? Now GIT reports a long list of deleted files, but there is no way to add that that change - actually REMOVE that change in an automated way. Or is there?

This little chunk of code finds all the deleted files, and adds them to the list of changes to be committed!