I am using this peice of code:
$target = \'extracted/\' . $name[0];
$scan = scandir($target);
To scan the directory of a folder which is
here is one function i used mostly to parse archives and directories
function scan_full_dir($dir,$child=false){
$dir_content_list = scandir($dir);
foreach($dir_content_list as $value)
{
if($value === '.' || $value === '..') {continue;}
// check if we have file
if(is_file($dir.'/'.$value)) {
echo '
File Name --> '.$value;
continue;
}
// check if we have directory
if (is_dir($dir.'/'.$value)) {
if(!$child){
echo '
parent --> '.$value;
}else{
echo '
child of '.$child.' --> '.$value;
}
scan_full_dir($dir.'/'.$value,$value);
}
}
}
output sample
parent --> fonts
File Name --> standard
parent --> steps
child of steps --> pcb
File Name --> .attrlist.sum
File Name --> .profile.sum
File Name --> .stephdr.sum
File Name --> attrlist
child of pcb --> netlists
child of netlists --> cadnet
File Name --> .netlist.sum
File Name --> netlist
File Name --> profile
File Name --> stephdr
// to scan dir
scan_full_dir('path/of/myfolder');
// to scan archive without opening it , supported formats : gz, zip, tar and bz files.
scan_full_dir('phar://uploads/youarchive.zip);