Updated Scandir to Disallow Invalid Files from the Directory