unlink() is only for files.
Try this function for directories...
function unlink_dir( $dir )
{
$handle = opendir( $dir );
while( false !== ( $file = readdir( $handle ) ) )
{
if( $file != '..' && $file != '.' )
{
unlink( $dir . '/' . $file );
}
}
}
Usage...
unlink_dir( '/the/directory' );