Hi,
I am sharing this tip with you all.The codes given below will explain
/**
* Checking a folder is empty or not.
* @param string $folderName
* $folderName should be folder name or path
* @return TRUE/FALSE (If any file or folder found/Empty folder)
*/
function checkFolderIsEmptyOrNot ( $folderName ){
$files = array ();
if ( $handle = opendir ( $folderName ) ) {
while ( false !== ( $file = readdir ( $handle ) ) ) {
if ( $file != "." && $file != ".." ) {
$files [] = $file;
}
}
closedir ( $handle );
}
return ( count ( $files ) > 0 ) ? TRUE: FALSE;
}