I am trying to create a folder structure that has multi-level subfolders. For example, I want to create a folder structure, for example "Fruits / Edible / Seedless". I tried this with mkdir ($ path), but this failed. I tried with a folder of the same level, created it. Help me create this subfolder structure.
Try using a recursive flag for mkdir ($ path, $ chmod, $ recursive)
<?php mkdir($path, 0, true); ?>
From php.net = recursive Allows you to create subdirectories specified in the path name. The default is FALSE.
bool mkdir ( string $pathname [, int $mode = 0777 [, bool $recursive = false [, resource $context ]]] )
See specifically: bool $recursive = false .
bool $recursive = false
http://php.net/manual/en/function.mkdir.php
You can also use the Linux exec command as follows to achieve this,
exec
<?php exec("mkdir -p ".$path); ?>
-p will not cause errors if the directory exists, otherwise it will create the directory along with the parent directories.
-p
Source: https://habr.com/ru/post/1386044/More articles:Calling an overloaded method from a common method problem - javaSymfony2 and Doctrine - returns the database result as an array of arrays in the controller - symfonyreplacing anchor text with image - htmlfast and efficient way to read a contribution-separated file using java - javahttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1386043/possible-to-connect-to-remote-desktop-with-php&usg=ALkJrhieSqCIoxrQ7NFdWu7scy921p6SZAASCII char with regex (java) - java"application failed to start ... configuration is incorrect" after update? - windowsJMockit and some local methods - javaWorkaround for Android error related to setRetainInstance (true) - androidIL Method call with 2 array arguments using Reflection.Emit - c #All Articles