Check if dir exists before glob()

I get an `Invalid argument supplied for foreach()` exception otherwise (on 1 system, other system works fine)