I was using count(glob("test/*"))
to count the sub-folders in the test
folder, but now that I also have files in the test
folder, not just folders, I get incorrect results. Is there a way to modify the glob
pattern so that it'll return only the folders, not files?
I've thought about a workaround. Get the total count of folders and files, get the count of files only, and then, subtract the count of files from the count of the whole.
$total_items = count(glob("test/*"));
$total_files = count(glob("test/*.*"));
$folder_count = $total_items - $total_files;
This works, but there might be a simpler way to do this.