5

I'm using chicagoboss for web development. To test some test modules I would like to change my current directory to something else. I know I can change directory by specifying full path to to cd("full path"). Suppose I'm in a directory "/home/user/workspace/myproject/myapp/" where I'm running myproject project.But now I want to check my current location using erlang shell.

Is there any function/command in erlang to get current working directory? In python I was using os.getcwd().

  • 2
    You may have better success in the long run if you look up `priv_dirs`. Each application in Erlang has a private directory for static data. Highly useful in some cases, though it is not directly what you are asking for. – I GIVE CRAP ANSWERS Mar 26 '14 at 19:52

2 Answers2

12

Try:

{ok, CurrentDirectory} = file:get_cwd().

Also check out erldocs.com to quickly look up functions in the Erlang documentation.

nu-ex
  • 691
  • 4
  • 9
7

Use the command:

pwd().

More text to get to the Stackoverflow minimum

radrow
  • 6,419
  • 4
  • 26
  • 53
Noel
  • 1,968
  • 3
  • 20
  • 38