[ Operating System | Reference Manual | Alphabetic Index ]

# cd(+Directory)

Directory is made the current working directory. Equivalent to set_flag(cwd, Directory).

Directory
  Atom or string of any form acceptable to the operating system.

## Description

Changes the current working directory to Directory. Directory may be an absolute or relative pathname.

### Modes and Determinism

- cd(+) is det

### Exceptions

(4) instantiation fault
  Directory is not instantiated.
(5) type error
  Directory is neither an atom nor a string.
(170) system interface error
  Directory doesn't exist.

## Examples

    Success:
          cd(workdir).
          cd("workdir").
          cd('/home/lp/user/workdir').
          cd('..').
          cd('../workdir').

    Error:
          cd(Dir).                    (Error 4).
          cd(20).                     (Error 5).
          cd('nonexist').             (Error 170).

## See Also

getcwd / 1, set_flag / 2