I am using this peice of code:
$target = \'extracted/\' . $name[0];
$scan = scandir($target);
To scan the directory of a folder which is
To determine whether or not you have a folder or file use the functions is_dir() and is_file()
For example:
$path = 'extracted/' . $name[0];
$results = scandir($path);
foreach ($results as $result) {
if ($result === '.' or $result === '..') continue;
if (is_dir($path . '/' . $result)) {
//code to use if directory
}
}