in reply to opendir slower than ls on large dirs?
Can't you just do this?
if (-e $filepath) { ... } [download]