Use DirectoryIterator instead of glob()