ls -1b, find the filename, copy the line on which it appears, and give that to
As others have suggested, most likely this is due to limitations in the way
ls--and some other programs, including client and server software--handle weird filenames, such as those containing control characters, by default. Your success with JdeBP's answer strongly suggests this was the case, though it would've been a good bet even before that.
ls, when standard output is a terminal,
? characters are printed in their place. So if you're not piping
ls's output to any other command (or redirecting it to a log for viewing), probably your filename doesn't contain control characters. But there are other problematic characters--perhaps the filename contains trailing whitespace, for example.
This behavior of
ls can be confusing but is not a bug, can can be overridden explicitly by the user (see below).
When attempting to access or remove a file remotely, bugs in client or server software can produce such problems.
I've experienced this sort of thing via
ftp myself several times, including for files whose names contain trailing spaces. (That it didn't work was due to a bug in my ftp client.) Even when you manually create a file yourself, depending on how you are creating it, it's sometimes quite easy to inadvertently insert a trailing space, or other whitespace that may look like spaces even though it isn't.
This is a situation where
ls -1b (or
dir -1) comes in handy:
ls to show one entry per line. That way there is no confusion about where one filename ends and another begins. This is handy for weirdly named files.
ls to print escape sequences for any special characters. The output of
ls -b can be copied and pasted literally into a command, with no added quoting: all problematic characters are already quoted in a way that causes the shell to recognize them as what they are.
There is only one caveat: if the last character on a line appears to be
\, copy one character after that, since this means
\ is quoting a space.
You can run
ls -1b just like that, or you can pass a shell glob pattern to it (e.g.,
ls -1b qyx*). Globbing may or may not find the file, depending on whether or not the control characters (or other weird characters) are present in the portion of the name appearing in the glob pattern.
Having copied the
\-quoted version of the filename given to you by
ls, you can paste this into a command. You don't have to modify it manually in any way. In your case, as you wish to delete the file, type
rm, type a space, paste the line, and press Enter.