Very, very nice and helpful! I probably wouldn't do it exactly this way on my system, but it's always good to see other approaches to this annoying and entirely unnecessary problem. One of my biggest pet peeves about macOS is its tendency to leave its "droppings" all over my SD Card filesystems and network shares, and I'm constantly searching for a nice clean, transparent way to fix this bug since Apple seems to have no intention of doing it themselves. So rude to be using my filesystem as their personal dumping ground for crap.
I would add ".fseventsd" and ".Spotlight-V100" folders to the cleanup targets, too.