CD into directory with "-" in the beginning

5

I have a problem with cd-ing into folder named "--Recovery Files" and can't remember how to escape dashes in the filename. Any ideas?

Ajax

Posted 2011-07-11T14:47:03.293

Reputation: 51

Answers

15

You can use:

cd -- '--Recovery Files'

The -- tells cd that no further command line arguments should be treated as options.

user53528

Posted 2011-07-11T14:47:03.293

Reputation:

10

2 choices:

  1. cd -- --Recovery\ Files
  2. cd ./--Recovery\ Files

glenn jackman

Posted 2011-07-11T14:47:03.293

Reputation: 18 546

5

cd -- '--Recovery Files'

The -- by itself indicates that subsequent words beginning with a dash are not to be interpreted as command-line options.

user89061

Posted 2011-07-11T14:47:03.293

Reputation: