When I run: grep -Hrn --color=auto --exclude-dir=idserver/sql anything
Then the subdirectory idserver/sql is not ignored (it's included in the output). The searching tree is like this: . ./idserver ./idserver/sql ./idserver/sql/tablename ./idserver/sql/tablename/2013-10-07.sql So if "./idserver/sql/tablename/2013-10-07.sql" has "anything" in it, then it gets outputted, because exclude-dir not working. My grep version: grep (GNU grep) 2.25 Copyright © 2016 Free Software Foundation, Inc. My distro: Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial Regards, George