Page 1 of 1

glob() syntax

Posted: Fri Aug 13, 2010 3:19 pm
by db579
Have been reading the glob() manual but can't seem to find any syntax for finding all files that don't match a pattern. For example I have this

Code: Select all

$picture_array = glob("$album/*_th.jpg");
which returns all files ening in _th.jpg. What I actually want it to do is return all files that DON'T end in that. How would I do this? Thanks

Re: glob() syntax

Posted: Fri Aug 13, 2010 3:33 pm
by AbraCadaver
You can't. glob() supports very limited regex, so glob for what you need like *.jpg and then when you loop through the array use a strpos() or preg_match() to eliminate the ones you don't want.