Examples (CD command)

Working with Absolute Paths

CD '/sales/data/july.sav'.
CD '/sales/data/july'.
CD '/sales/data/july'.

If /sales/data is a valid directory:

  • The first CD command will ignore the filename july.sav and set the working directory to /sales/data.
  • If the subdirectory july exists, the second CD command will change the working directory to /sales/data/july; otherwise, it will change the working directory to /sales/data.
  • The third CD command will fail if the data subdirectory doesn't exist.

Working with Relative Paths

CD '/sales'.
CD 'data'.
CD 'july'.

If /sales is a valid directory:

  • The first CD command will change the working directory to /sales.
  • The relative path in the second CD command will change the working directory to /sales/data.
  • The relative path in the third CD command will change the working directory to /sales/data/july.