Make length check bounded to directory.