Have you tried using glob?
It seems to run quicker that grep/regex/, readdir on large dirs on my system when using a wildcard.
In reply to Re: opendir slower than ls on large dirs?
by BrowserUk
in thread opendir slower than ls on large dirs?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |