2

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:

no can do

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?

3 Answers 3

1

I'm not sure how Windows and Mac do that (are you sure they are not silently renaming the files and removing these characters?), but Microsoft's own exFAT specification says that question mark, asterisk, colon and vertical bar (and few other characters) are not allowed in file names so Linux is correct here when not allowing you to create these files on an exFAT formatted drive.

1
  • macOS converts | in filenames (as well as double quotes, apparently) to · (middle-dot character) on the fly, while passing ?, !, and : through unchanged; Windows passes them all through as is, so far as I can tell.
    – Vikki
    Commented Jul 7, 2021 at 20:43
1

From Wikipedia, https://en.wikipedia.org/wiki/ExFAT :

Allowed characters in filenames: all Unicode characters except U+0000 (NUL) through U+001F (US) / (slash) \ (backslash) : (colon) * (asterisk) ? (question mark) " (quote) < (less than) > (greater than) and | (pipe) (encoding in UTF-16LE)

3
  • Doesn't explain the trouble with !, though...
    – Vikki
    Commented Jul 7, 2021 at 21:13
  • "!" must be allowed but then it could be not just "!" but some UTF symbol which looks like it but it's not it. :-) Google for utf-8 homoglyphs or read this interesting article: en.wikipedia.org/wiki/IDN_homograph_attack Commented Jul 7, 2021 at 21:15
  • 1
    For a test you could open a terminal and try running this touch '/media/mssean/!!!test.txt' - it works here. Commented Jul 7, 2021 at 21:26
0

Either rename your invalid files so that they can be copied to an exFAT filesystem or use a non-exFAT filesystem as a destination.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .