0

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.

0

1 Answer 1

2

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' {} +
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.