
Function: Create_Directory
Create a directory if it does not exist. This function also creates intermediate directories if necessary.
Prototype:
string result = create_directory ( string path);
Parameters:
| Parameter name | Type | Description |
|---|---|---|
| Path | string | path to the target directory |
Return value: Type string : Returns "OK" if the directory exists or is created. Otherwise, an error message.
Example:
string res = create_directory("/Users/ole/Desktop/loggfiles/a/b/c/d/e/f");
Suppose "loggfiles" does not exist from before then the following happens.
- The directory "loggfiles" is created on the desktop of user "ole", then
- "a" inside it, then
- "b" inside "a", then
- "c" inside "b", then
- "d" inside "c", then
- "e" inside "d", then
- finally "f" inside "e".
Otherwise, if some of the directories in this path do not exist, they are created as needed.
See also:
- Directory_exists
- File_Exists
