Jeel Jeel -4 years ago 93
Bash Question

Shell Script for searching Makefile recursively in directories

I need to build a shell script on debian based OS to recursively browse and identify which Folders have Makefile present. If present then build the package. If not present then just list those folders. The catch here as shown below is I need to browse only one folder below the parent folder (ABC) and check if makefile is present under Folder1, Folder 2...etc and not to go into the sub directories of Folder1 (not to look for Makefile under folders Folder1.1, Folder 1.2, Folder2.1 etc). Looking for some tips how to loop only one level and then exit back to folder ABC and start the search.

| |-------Makefile

| |-------Somefile
| |-------Makefile

Answer Source

As answered by Karthikraj in above comments. This helped

find . -maxdepth 2 -type f -iname 'makefile'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download