Use make-directory* from the file.ss module in Mzlib. For example:
> (require (lib"file.ss"))
> (directory-exists?"foo") ; show the directory doesn't exist
#f> (make-directory*"foo") ; create the directory
> (directory-exists?"foo") ; show the directory exists
#t> (make-directory*"foo") ; no error is raised if the directory already exists
The function make-directory* will make all the directories specified by it's argument that don't already exist. So to create the directory tree "foo/bar" (if it doesn't already exist) you could call make-directory* like so:
> (make-directory*"foo/bar")
If you wanted to ensure that only one directory was created, not an entire tree, you could build your own function on top of make-directory. The function make-directory raises an exception if the directory already exists so you have to check for the directory before you attempt to create it. The function maybe-make-directory does this: