Delete directory from private folder programatically?
Note that glob('*') ignores all hidden files by default. This means it does not return files that start with a dot (e.g. .file).  If you want to match those files too, you can use {,.}*  as the pattern with the GLOB_BRACE flag. This will include the special cases . and .. so you need to exclude those by using {,.}[!.,!..]*.

So in summary, try the following:

$files = glob("$folder/" . '{,.}[!.,!..]*',GLOB_MARK|GLOB_BRACE);


As a sidenote: you mention you tried using rm_dir. I assume you mean rmdir?