php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32516 mkdir's recursive parameter
Submitted: 2005-03-31 15:41 UTC Modified: 2005-04-06 10:41 UTC
Votes:2
Avg. Score:1.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: cbelin at free dot fr Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 5.0.3 OS: Windows XP
Private report: No CVE-ID: None
 [2005-03-31 15:41 UTC] cbelin at free dot fr
Description:
------------
What is the purpose of the 'recursive' parameter of the 'mkdir' function ?

I expected that it allow to create a directory structure recursively but it doesn't seem to work !


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-31 20:38 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2005-04-01 09:21 UTC] cbelin at free dot fr
Here is a simple example of the "bug" :
<?php
mkdir("toto/tata/titi/tutu", 0777, true);
?>

It outputs :
Warning: mkdir() [function.mkdir]: No such file or directory in D:\Serveur Web\...\toto.php on line 2

Instead, I must use successive mkdir() calls :
<?php
mkdir("toto", 0777);

chdir("toto");
mkdir("tata", 0777);

chdir("tata");
mkdir("titi", 0777);

chdir("titi");
mkdir("tutu", 0777);
?>
 [2005-04-03 16:50 UTC] tony2001@php.net
Use appropriate slashes on Windows (i.e. DIRECTORY_SEPARATOR constant).
I doubt this behaviour will be changed ever, because "dir\name" is perfectly valid directory name on *nix. 
 [2005-04-06 10:41 UTC] cbelin at free dot fr
Yes ! It works with the proper use of DIRECTORY_SEPARATOR constant. Thanks
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 03:01:23 2020 UTC