$rootDir = OC::$SERVERROOT; $path = $rootDir . '/newDir'; // Set new directory path mkdir($path); // Create new directory
$dir = '/existingDir'; $path = OC_Filesystem::normalizePath($dir . '/newDir'); mkdir($path); // Create new directory inside existing directoryIn both examples, we use the `mkdir` function to create a new directory in the specified path. We also make use of the `OC_Filesystem::normalizePath` method to ensure the path is formatted correctly for the ownCloud file system. The `mkdir` function is a part of the `OC\Files\Filesystem` class, which is a part of the ownCloud `oc.files` package.