i m trying to check and make muliple dir in a single command by mkdir command bt nt get success, is there any alternative or how to use it. . Ex- file/a/b/c i want to if there a,b or c dir present if nt create which is nt present. If a, present bt b,c nt then create b and c both.. Pls share if u knw the solution .. At present i m using loop to do this .
how to use mkdir in php
Collapse
X
-
Make an array with a b c names, do foreach() loop with if() and is_dir(), and if it returns true set continue; else mkdir().
Check this for start: http://coding-talk.com/f46/source-co...html#post97296<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
-
try this
Added after 6 minutes:PHP Code:<?php // Desired folder structure $structure = './depth1/depth2/depth3/'; // To create the nested structure, the $recursive parameter // to mkdir() must be specified. if (!mkdir($structure, 0, true)) { die('Failed to create folders...'); } // ... ?>
Try this 101% working
PHP Code:<?php $foldername="hello"; mkdir("$foldername", 0777); // create folder chmod( "$foldername", 0777 ); // chmod folder to 0777 mkdir("$foldername/pics", 0777); // create folder chmod("$foldername/pics", 0777 ); // chmod folder to 0777 echo"Sucessfully created"; ?>Last edited by arbind004; 18.06.12, 09:44.
Comment
Comment