0

I am using CentOS 7. I have a folder name "-r". This happened accidentally when I executed a tar command. I need to remove this folder but somehow -r option is taken as switch to the commands rm,rename,mv etc.. How do I remove this

Sujeesh
  • 3
  • 1

1 Answers1

2

To remove this folder you can try something like:

rm -r -- -r

Double dash tell to command this is the end of options and follow arguments (in your case directory name)

Romeo Ninov
  • 5,263
  • 4
  • 20
  • 26
  • Also possible: `rmdir ./-r` (using `rmdir` assuming the directory is empty.) Using `./` to refer to local files is enough to prevent commands from interpreting them as options. – filbranden Mar 13 '20 at 02:18