I have a file named +13x18_DSC_0800.JPG on a linux server (Please don't ask me how it got there as I have no idea how it got there). I wish to rename it to 13x18_DSC_0800.JPG. However I have not been able to. When I try to copy it I get ;

# cp \+13x18_DSC_0800.JPG asd.JPG
  cp: cannot stat `+13x18_DSC_0800.JPG': No such file or directory

Here is some more inforamtion ;

 -rwxrwxrwx  1 ftpuser renko 2798985 2011-10-14 01:12  +13x18_DSC_0800.JPG*

I really don't know what is wrong other than that the plus sign is killing some script. Some more information ;

#uname -a
Linux server-1 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Any help would be awesome...


Often this means there are some non-printing characters in the filename, which you can't see because they're non-printing.

Try ls -la > /tmp/foo then vi -b /tmp/foo to look at all the text.

If that's the case, the easiest way is to handle it via glob, try echo *13x18_DSC_0800* to verify that the glob matches that file (and only that file), then you can do mv *13x18_DSC_0800* newname.jpeg to rename it.

  • Or ls -la | cat -vT – Janne Pikkarainen Dec 5 '11 at 10:33
  • @MadHatter I got a "-rwxrwxrwx 1 ftpuser renko 2798985 2011-10-14 01:12 +13x18_DSC_0800.JPG -rwxrwxrwx 1 ftpuser renko 2567144 2011-10-14 01:12 +13x18_DSC_0848.JPG " – JohnRoach Dec 5 '11 at 10:40
  • @MadHatter Although I haven't been able to resolve this issue without using the joker card i.e. "". Here is the solution I have been able to find ; #cp *DSC_0800 13x18_DSC_0800.JPG #rm + This seems to do the trick... I still wonder why I couldn't do it without using the * .... Since you reminded me of the * you get the bonus! – JohnRoach Dec 5 '11 at 10:49


cp "+13x18_DSC_0800.JPG" 13x18_DSC_0800.JPG
  • Sorry but no cigar you get a : "cp: cannot stat `+13x18_DSC_0800.JPG': No such file or directory" error – JohnRoach Dec 5 '11 at 10:35

stupid and simple solution if you want to get rid of just one file - use midnight commander :D

but + sign at the beginning shouldn't be a problem at all ...

    $ touch +13x18_DSC_0800.JPG
    $ mv +13x18_DSC_0800.JPG test.jpg
    $ rm test.jpg

works for me ...

  • [edited] actually it did not work... the test.jpg turned out to be a 0 byte file... – JohnRoach Dec 5 '11 at 10:36
  • 1
    touch does create an empty file with that name if it does not exist. i was presenting this as an example of it working. – Fox Dec 5 '11 at 10:42

For me

    cp +13x18_DSC_0800.JPG 13x18_DSC_0800.JPG

worked like charm, without any escaping.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.