Updated scanAllDirectory procedure.