Skip over ._ mac files
Posted: Wed Oct 05, 2011 10:48 pm
I need to make an array of file names from a directory.
I'm using this:
I'm using this:
Code: Select all
if ($handle = opendir($image_dir)) {
while (false !== ($file = readdir($handle)))
{
if ($file != '.' && $file != '..' && $file != '._*')
{
$files[] = $file;
}
}
closedir($handle);
}[ /syntax]
It works, but the people who are putting the files in the directories are using macs, so there are the ._ resource fork files and these get included in the array, which messes other things up.
I was hoping that "!= '._*'" would take care of it, but it doesn't. Is there any wildcard character I can use or will i have to work something out with a substring?
I'm not very good with php, so any help you guys could offer would be greatly appreciated. Thanks!