1

Possible Duplicate:
Unix: Files starting with a dash, -

Somehow I ended up with a file named "-r". How do I remove it? rm -r doesn't work. I tried 'rm -i `ls -a`' to step through the file names, but it didn't prompt me to delete this one.

Edit A very hacky approach was to use python's os.unlink function. That worked, but I'm curious to hear other ways.

pythonic metaphor
  • 2,306
  • 6
  • 23
  • 30

1 Answers1

6

From man rm:

To remove a file whose name starts with a '-', for example '-foo', use one of these commands:

rm -- -foo
rm ./-foo
Andy
  • 3,037
  • 3
  • 20
  • 28