Jump to content

[SOLVED] mkdir question


phpknight

Recommended Posts

I have a question about the php mkdir() function.  The docs say it returns TRUE on SUCCESS and FALSE on FAILURE.

 

However, if you call this function on a directory that already exists, does it a) return true or false, and more importantly b) does it erase the current directory contents or leave it untouched?  I understand that is_dir would likely be called, too, but I need to know if files would be erased in case some call ever got through the cracks. 

Link to comment
https://forums.phpfreaks.com/topic/63616-solved-mkdir-question/
Share on other sites

I just did a test an it is turning '0' when a directory exists and also a warning 'Warning: mkdir() [function.mkdir]: File exists in blah blah'. Anyways just to be sure and surpress error messages u can use file_exists() to check if the directory exists or not, but in each case it will not delete a directory and all its files and create a blank one.

Link to comment
https://forums.phpfreaks.com/topic/63616-solved-mkdir-question/#findComment-317064
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.