8.5.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)
8.0.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)
8.1.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)
8.2.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)
8.3.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)
8.4.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)
8.6.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)
7.x file.inc drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL)

Creates a directory, optionally creating missing components in the path to the directory.

Deprecated

in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystem::mkdir().

Related topics

7 calls to drupal_mkdir()
DirectoryTest::testFileCheckLocalDirectoryHandling in core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php
Test local directory handling functions.
FileTestBase::createDirectory in core/tests/Drupal/KernelTests/Core/File/FileTestBase.php
Create a directory and assert it exists.
file_prepare_directory in core/includes/file.inc
Checks that the directory exists and is writable.
LocalStream::mkdir in core/lib/Drupal/Core/StreamWrapper/LocalStream.php
Support for mkdir().
ReadOnlyStreamWrapperTest::testReadOnlyBehavior in core/tests/Drupal/KernelTests/Core/File/ReadOnlyStreamWrapperTest.php
Test read-only specific behavior.

... See full list

File

core/includes/file.inc, line 1158
API for handling file uploads and server file management.

Code

function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) {
  return \Drupal::service('file_system')
    ->mkdir($uri, $mode, $recursive, $context);
}