Correction to filter dirrectory

It only check for one dir per dir.