Here's a handy little function to force-create directories in PHP. If the directory does not exist, it will create it. If there is a file with such a name, it will delete that file and create the directory in its place. Params: same as http://us.php.net/manual/en/function.mkdir.php Returns: true on success (the given path is now a directory), false on error function super_mkdir($file, $mode = 0777, $recursive = false) { if (!file_exists($file)) return mkdir($file, $mode, $recursive); if (is_dir($file)) return true; if (!unlink($file)) return false; if (!mkdir($file, $mode, $recursive)) return false; return true; } I will possibly have a better version later which would return error codes instead of just false...