Sanitize filenames in linux 2016-08-19

I recently had to move a big media directory (lots of files in many directories and subdirectories) onto a network drive from a linux machine. As you might expect, there were a lot of problems with file and directory names. After some frantic googling and testing, I managed to piece together the information presented here: Sanitize filenames in linux.