I have the following code in the efforts of checking if a directory is empty before using rmdir. I'm doing something wrong but don't know what. Can anyone help me figure this out? What's wrong with my code below, or is there a better way to check if a directory is empty other than readdir?
$OpenDir=opendir("../../Audio-MP3/Uploads/".$WebPage."/". stripslashes($Row["Directory"]));
if (readdir($OpenDir)<>""){
if(is_dir("../../Audio-MP3/Uploads/".$WebPage."/". stripslashes($Row["Directory"]))){
rmdir("../../Audio-MP3/Uploads/".$WebPage."/". stripslashes($Row["Directory"]));
}
}