Name
CreateDirectory -- create a new directory (V11.0)
Synopsis
d$ = CreateDirectory(path$, dir$[, table])
Library
dos

Function
This function creates the directory specified by dir$ in the path specified by path$. This is basically the same as calling MakeDirectory() but there is the difference that CreateDirectory() doesn't accept a single path argument containing both the path and the subdirectory specification but two individual arguments specifying the directory where to create the new subdirectory and the name of the subdirectory to be created. It also can't create directories recursively but only a single directory can be created and it returns the path to the directory just created. All this makes CreateFile() suitable for use with Android's Storage Access Framework (SAF) and with MediaStore on Android which both work a little differently than traditional path specifications. See Working with Android URIs for details.

Note that in contrast to MakeDirectory(), CreateDirectory() will fail if the directory already exists.

CreateDirectory() also accepts an optional table argument which can be used to pass additional parameters. The following table elements are currently recognized:

Adapter:
This tag allows you to specify one or more file adapters that should be asked to create the specified directory. This must be set to a string containing the name(s) of one or more adapter(s). Defaults to the adapter set using SetDefaultAdapter(). See Loaders and adapters for details.

UserTags:
This tag can be used to specify additional data that should be passed to file adapters. If you use this tag, you must set it to a table of key-value pairs that contain the additional data that should be passed to plugins. See User tags for details.

Inputs
path$
path for the new directory
dir$
name for the new directory
table
optional: table containing further parameters
Results
d$
path to the newly created directory

Show TOC