I want to check if a directory exists, if not create it.
How can I achieve this? I tried writeFile
since I wanted to create a file in it, but that doesn't seem to work.
existsDir
: http://nim-lang.org/docs/os.html#existsDir,string
createDir
: http://nim-lang.org/docs/os.html#createDir,string
So this should work:
import os
let dir = "foo"
if not existsDir(dir):
createDir(dir)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With