lookup file only when different than a directory

Indeed we were executing some file specific stuffs
even if the file was a directory.