Reputation: 10221
I have www folder with lots of php projects. Hidden somewhere is a script in a /cli/
folder that I'm trying to find. If I use this in the www folder:
grep -R "mycode" */cli/*
It's only finding files in projectname/cli/
But the cli folder is in a subdirectory somewhere. So I need it to match projectname/subdir/cli/
or projectname/subdir/subdir/cli/
etc.
Upvotes: 0
Views: 89
Reputation: 23677
See if your shell supports shopt -s globstar
(or similar). You can then use **/cli/
to match cli
recursively.
Or, using find
find -type d -name 'cli' -exec grep -R 'mycode' {} +
Upvotes: 2