Removed "-M" flag and made the metadata copy universal, added error checking, made string matching a bit more fault-tolerant, added devnull redirects.  Basically just tweaked gtmanfred's code to feel more like my style.