I've got a bunch of video files on my laptop's internal ext4 SSD (running Ubuntu 20.04, but this same error would presumably occur on any Linux install running kernel version 5.4 or newer, as exFAT support is built into the kernel rather than being added on top of it), and I'm trying to move or copy them to an exFAT USB flash drive so I can transfer them to my Windows 7 desktop.
Unfortunately, most of the files refuse to be moved or copied to the exFAT drive:
For the benefit of the screenreader-users out there, the error message is
Error while copying "[FILENAME]".
There was an error copying the file into [DESTINATION PATH].
Invalid filename
Something all of these files have in common is that their filenames contain one or more of the following characters:
- ? (question mark)
- ! (exclamation point)
- : (colon)
- | (vertical bar)
The presence of these characters in their filenames is presumably the reason Ubuntu is refusing to move or copy these files to the flash drive (every file I have ever tried to move from my laptop's SSD to an exFAT flash drive whose filename contains any of these four characters has thrown up this error, and I don't recall having ever seen this error with files whose names don't contain any of these four characters), presumably because it deems filenames containing said characters to be invalid under exFAT.
This same error occurs if I try to download a file with a filename containing any of these characters directly to the flash drive; it also occurs no matter what flash drive I use (I have a whole bunch of exFAT USB flash drives from at least three different manufacturers).
Yet filenames with these characters obviously aren't invalid under exFAT, as Windows (tested under Windows 7) and copies/moves/downloads files with such names to exFAT drives without any fuss, and macOS (tested under Yosemite) happily copies/moves/downloads files with names including ?, !, or : to exFAT drives, while converting | in filenames to · (middle dot) and then happily copying/moving/downloading said files to exFAT drives. So what is going wrong here, and how do I fix it?