The standard glob() function usage is like
$dir = glob("*.txt");
foreach ($dir as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
using * as wildcard, but is there a way to negate it to ignore any file that starts with underscore like _something.txt? I am trying to avoid using preg_match() like
$dir = glob("*.txt");
foreach ($dir as $filename) {
if (! preg_match("^_+", $filename, $match) { // doesn't show if 1st char is _
echo "$filename size " . filesize($filename) . "\n";
}
}
but instead use glob()'s own regex to avoid loading unnecessary files in the first place, assuming this will be faster.