function traverse_folder($path = '.') {
$current_dir = opendir($path);
while(($file = readdir($current_dir)) !== false) {
$sub_dir = $path . DIRECTORY_SEPARATOR . $file;
if($file == '.' || $file == '..') {
continue;
} else if(is_dir($sub_dir)) {
traverse_folder($sub_dir);
} else {
//......
}
}
}
;