Search code examples
shellcygwin

cd to a directory doesn't work but ls does - why is this happening?


I started using fish today via Cygwin on Windows 10.

Whenever I execute

ls "G:/My Drive/"

I get a list of files and folders within that directory, which indicates that it can find the directory I am pointing ls to.

However, when I execute

cd "G:/My Drive/"

I get an error:

cd: The directory “G:/My Drive/” does not exist

I reinstalled Cygwin and also updated fish and it still behaves the same.

Why doesn't cd work?


Solution

  • I discovered why this was happening; perhaps it can help others who experience the same problem.

    It turns out that fish was mounted onto my drive, so instead of typing

    cd "G:/My Drive/"
    

    I have to type

    cd /cygdrive/g/My\ Drive/dataSources/
    

    UPDATE (27th March 2019):

    I found some documentation that highlights this in more detail.