I have some podcasts on my radio server which contain a timestamp when they should be played. I noticed one of them is put into single quotes 'filename.mp3', and I'm unable to remove them. Check this:

4,0K drwxr-xr-x 2 user group 4,0K  4. Apr 20:40 .
4,0K drwxrwsr-x 6 user group 4,0K  4. Apr 20:28 ..
 83M -rw-r--r-- 1 user group  83M  4. Apr 20:32 2016-03-09-22-00-moshtrocity.mp3
173M -rw-r--r-- 1 user group 173M  4. Apr 20:40 2016-03-25-10-00-funkfabrik-classic-25.mp3
 53M -rw-r--r-- 1 user group  53M  4. Apr 20:41 '2016-04-01-21-00-Wasted Fridays.mp3'

Now, I tried to escape the \' like that, but I get:

 $ mv \'2016-04-01-21-00-Wasted\ Fridays.mp3\' 2016-04-01-21-00-Wasted\ Fridays.mp3 
mv: cannot stat ''\''2016-04-01-21-00-Wasted Fridays.mp3'\''': No such file or directory

Now, it looks like it ignores the quotes. I tried without, look at this:

 $ mv 2016-04-01-21-00-Wasted\ Fridays.mp3 2016-04-01-21-00-Wasted\ Fridays.mp3
mv: '2016-04-01-21-00-Wasted Fridays.mp3' and '2016-04-01-21-00-Wasted Fridays.mp3' are the same file

Uh, how to deal with that? How to remove a single quote from a file name?

I'm on ArchLinux if this matters. Filesystem is ext4.

  • Is your 'ls' aliased to something? It looks like it may be adding quotes "for" you. Try /bin/ls to compare.
    – Jeff Schaller
    Apr 6, 2016 at 9:52
  • That's probably it, don_crissti. 5chdn, you can confirm with something like ls | cat
    – Jeff Schaller
    Apr 6, 2016 at 10:21
  • ls -N is the solution. Is does some weird stuff. not related to alias. and the file name is intact.
    – q9f
    Apr 6, 2016 at 10:47
  • 1
    ls no longer does what the user wants or expects, and instead of following the unix tradition has decided to do it's own thing. I'm annoyed too.
    – Wyatt Ward
    Apr 22, 2016 at 23:43


Browse other questions tagged or ask your own question.