I want to list only the directories that are not inside a .git/ directory on my current path. I'm trying this: find . -path **/.git -prune -o -print -type dThe .git dirs are excluded, but the snippet is also listing files. But it should not as I specified -type d. How to make the find utility behave as I described? 
How to list only directories that are not on a `.git` directory subpath?
find
You've used -print before -type d, so find print all things not satisfied the first expression.You want to swap them:find . -path '*/.git' -prune -o -type d -printor using predicate only, so you can omit -print:find . ! \( -path '*/.git' -o -path '*/.git/*' \) -type dAlso note that you only need to use one asterisk */.git, double asterisk ** has no special meaning to find pattern matching. And you can make it simpler, more portable and slightly faster by using -name instead of -path:find . -name .git -prune -o -type d -print