Not as subversive as it sounds, this is the result of my noticing that some files failed to copy onto my MP3 player. The reason turned out to be because their names contained characters which are invalid in FAT file systems: /?<>\:*|"^. This python script acts rather like cp -r but replaces any of the illegal characters with the _ character. Note that I've removed the .py suffix to prevent the server from thinking you want to execute it in place rather than download it.

Tip: I use a UTF-8 locale, but my MP3 player uses ISO-8859-1. By mounting it with the option iocharset=iso8859-1 the filenames are automatically translated. mount(8)'s man page implies that this is the default but I had to specify it explicitly.

Download mp3copy 1.0