I am trying to write a simple electron script to switch between my different time machine backups, but I have gotten somewhat stuck because tmutil keeps throwing errors when a volume name has a space in it, just as in
sudo tmutil removeexclusion -v /Volumes/MacOS Mojave
/Volumes/MacOS Mojave: The operation couldn’t be completed. Invalid argument
oK, that one was still pretty obvious, but now, what about
sudo tmutil removeexclusion -v "/Volumes/MacOS Mojave"
/Volumes/MacOS Mojave: The operation couldn’t be completed. Invalid argument
or even
sudo tmutil removeexclusion -v /Volumes/MacOS Mojave
/Volumes/MacOS Mojave: The operation couldn’t be completed. Invalid argument
man tmutil
doesn’t really go into any details about spaces or special characters in their documentation, escaping characters and quoting the paths are both ways to do this usually, but apparently not in this case.