I want to delete a directory associated to a record but not if the directory is not empty although I know by default we cannot delete a non empty dir by rmdir()
and it will flash an error. But this is a compiler error and I want to print a error within the application telling the user why the dir can not be deleted. basically what I'm looking for is something like this:-
public function actionDelete($id)
if(some condition here to check the dir is empty)
{
rmdir("path of the dir")
}else {
a flash msg here saying directory is not empty
}
provided that using yii2
framework of php.