0

In a subfolder of my home dir, There is a file called '-r'

-rw-r--r-- 1 pi pi 10240 Sep 15 18:19 ./prog_python/-r

I don't even know why.

I would like to rename the file or delete it, but nothing like rename '/-r' newName or rename '\-r' newName works. Any advice ? Thanks !

2 Answers2

0

You need a "./" in the right place:

cd ~/prog_python
mv ./-r something
Thomas Dickey
  • 75,040
  • 9
  • 171
  • 268
0

You don't have to escape anything if you just type out the full path, like

mv ~/yoursubfolder/prog_python/-r newName

or

rm ~/yoursubfolder/prog_python/-r
DisplayName
  • 11,468
  • 20
  • 73
  • 115
  • many thanks ! I've also found this solution, but yours is way more efficient and easy to use : `find . -type f -name '?r' -exec mv {} renamed \;` – Fly Jodel Oct 15 '16 at 16:35