0

I have a file with the following name (I didn't name it!):

'A MULTI BAND MINI PRINTED OMNI DIRECTIONAL'$'\n''ANTENNA WITH V-SHAPED FOR RFID APPLICATIONS.pdf'

Weirdness is caused by the '$'\n' in the middle of the filename.

I can't do anything with this file except show it in ls!.

How do I remove or rename this file?

I've looked at other answers on this site and tried the solutions provided - they all seem to have absolutely no effect. ls -l shows the following permissions for the file:

-rwxrwxrwx

rothloup
  • 111
  • 8
  • 2
    Assuming the quotes are not part of the file name, I created a file with this name as follows: `touch 'A MULTI BAND MINI PRINTED OMNI DIRECTIONAL'\$'\n''ANTENNA WITH V-SHAPED FOR RFID APPLICATIONS.pdf'`. A directory listing shows `-rw-rw-r-- 1 bbausch bbausch 0 May 6 14:38 A MULTI BAND MINI PRINTED OMNI DIRECTIONAL$\nANTENNA WITH V-SHAPED FOR RFID APPLICATIONS.pdf `. To delete it, I then typed `rm A` followed by a tab; the filename was expanded, and the `rm` command succeeded. – berndbausch May 06 '21 at 05:36
  • 1
    I also created a file with the quotes in the name. To remove that, `rm "'"*` (hoping no other filename starts with a quote). – berndbausch May 06 '21 at 05:41
  • What shell are you using? What did you try to remove or rename the file? – Stéphane Chazelas May 06 '21 at 06:02
  • 1
    If you have a modern Linux system (Ubuntu 18.04 is modern enough, 16.04 isn't), the default output of `ls` is exactly what you need to type in your shell. – Gilles 'SO- stop being evil' May 06 '21 at 07:33
  • @berndbausch: I should have mentioned that the obvious solution, `rm A ` doesn't work. It simply won't expand the filename. Once I type "A", it won't auto-complete. If I type `A\ M`, tab completion ERASES the '\ M' and leaves the A! I don't get it. – rothloup May 07 '21 at 01:34
  • @berndbausch, no the quotes are not part of the filename. that's just how it's shown in the output of `ls` – rothloup May 07 '21 at 01:35
  • @StéphaneChazelas: I'm using bash, but could use something else if it will work. – rothloup May 07 '21 at 01:36
  • @Gilles'SO-stopbeingevil': If I take the output of ls, highlight it, and paste it into `ls ` or `rm `, the response is "No such file or directory. – rothloup May 07 '21 at 01:37
  • My guess is that there are non-printable characters in the filename. I am not sure if `ls` has an option to show them; if all else fails, you could pipe `ls` output into `cat -v` or `od -c`, for example. – berndbausch May 07 '21 at 01:48

1 Answers1

1

User beware: The problem here was that file I was working with was on a network file system mounted via cifs. I guess those weird filenames just don't work well over networked file systems.

The solution was to ssh into the NAS box and remove the file using rm in a local shell.

rothloup
  • 111
  • 8