Req #48401 [Fbk->NoF]: File & Directory Functions: Auto create intermediate directories from filepath

From: Date: Sun, 12 Sep 2021 04:22:07 +0000
Subject: Req #48401 [Fbk->NoF]: File & Directory Functions: Auto create intermediate directories from filepath
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236544@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48401&edit=1

 ID:               48401
 Updated by:       php-bugs@lists.php.net
 Reported by:      stefan-nowak-php at mailinator dot com
 Summary:          File & Directory Functions: Auto create intermediate
                   directories from filepath
-Status:           Feedback
+Status:           No Feedback
 Type:             Feature/Change Request
 Package:          Filesystem function related
 Operating System: *
 PHP Version:      5.*
 Assigned To:      cmb
 Private report:   N

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2021-08-31 10:14:18] cmb@php.net

That raises the question, though, what file permissions should be
set.  Since mkdir() allows to specify these explicitly, and it
supports the $recursive parameter, isn't that sufficient?

------------------------------------------------------------------------
[2009-05-26 22:33:11] stefan-nowak-php at mailinator dot com

User TrentTompkins provides a workaround function at:
http://php.osmirror.nl/manual/de/function.file-put-contents.php#84180

And everyone can built similar workarounds. But as originally said, it 
would be nice if this feature would be included in PHP's built-in file 
and directory functions.

------------------------------------------------------------------------
[2009-05-26 22:20:30] stefan-nowak-php at mailinator dot com

Description:
------------
It would be nice if all/some of PHP's file and directory functions would 
offer a flag AUTO_CREATE_DIRS, which would then cause these functions to 
automatically create directories for the given filepath, which yet don't 
exist.

Many shell tools allow similar functionality (i.e: mkdir -p)

Reproduce code:
---------------
file_put_contents ( "/existing-dir/not-yet-existing-dir/file", "test");
// Warning: file_put_contents (existing-dir/not-yet-existing-dir/file): failed to open stream: No
such file or directory



Expected result:
----------------
file_put_contents ( "/existing-dir/not-yet-existing-
dir/sub1/sub2/file.txt", "test", AUTO_CREATE_DIR);
// If my sugestion would be implemented I would then expect PHP to 
automatically create the directories:
// not-yet-existing-dir , sub1, sub2
// and the file:
// file.txt



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=48401&edit=1


Thread (4 messages)

« previous php.bugs (#236544) next »