public function createFolderIfNotExists($folderPath) {
        if (file_exists($folderPath) && is_dir($folderPath)) {
            return;
        }
        
        $arrFolder = explode(DIRECTORY_SEPARATOR, $folderPath);
        
        $fullPath = "";
        $first = true;
        foreach ($arrFolder as $folder) {
            if (!$folder) {
                continue; //Happens if the first char is a slash
            }
            if (!$first) {
                $fullPath .= DIRECTORY_SEPARATOR;
            } else {
                $first = false;
            }
            
            $fullPath .= $folder;
            
            try {
                $this->createSingleFolderIfNotExists($fullPath);
            } catch (Exception $e) {
                $msg = $e->getMessage();
                echo "Could not generate folder '".$fullPath."' <br />\n"
                        . $msg
                        . "<br />";
            }
        }        
    }