While looping through a directory for images using this php code, I need to filter out the system files that my MAC dev computer insists on creating.
First I only had to filter out
.DS_Store
files, lately there has appeared files looking like this as well:
._.DS_Store
if ($handle = opendir($server_dir)) { //if we could open the directory...
while (false !== ($entry = readdir($handle))) { //then loop through it...
if ( ($entry != ".") && ($entry != "..") && (strpos($entry, ".DS_Store") !== false) && (strpos($entry, "._.DS_Store") !== false) ) { //and skip the . and .. entities
$m .= '
'.$client_dir.$entry.'
';
}
}
closedir($handle);
}
else {
echo("Can't open $dir, does it exist? Does www-user have permission to read it?");
}
Is there any other name of hidden system files that I need to filter out or are these two it?
Is there any better way of handling this than the way I do it?