I am trying to delete a directory but it will have 2 files inside. So i have tried to use the unlink function to delete the files first and then the directory. I f i only have one file inside the directory my php is fine, however when i have two files inside i php throws up an error saying that it cant delete the directory becuase it has a file inside? One of the files, but the other got deleted?

This is my php.

PHP Code:
elseif(\$type=="delete"){

if(
is_numeric(\$_GET['t'])){

\$getDir=mysql_query("select * from template where Temp_ID='{\$_GET['t']}'",\$con);

\$dirName=mysql_fetch_assoc(\$getDir);

\$dirDelete="../templates/".\$dirName['Path'];

if(

rmdir(\$dirDelete);

\$sql11="delete from template where Temp_ID='{\$_GET['t']}'";

mysql_query(\$sql11,\$con);
}

}else{

\$msg1="Not a valid URL";
}
echo