Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Traversing directories using shell script

I am trying to traverse all directories under the current directory using a shell script. In each of those sub directories, there is a makefile and I want to execute it. Any idea how to do ?

like image 532
uyetch Avatar asked Aug 31 '26 14:08

uyetch


1 Answers

Try with find :

find -iname makefile -execdir make -f {} \;

That will find every file named makefile (or Makefile, or whatever different case for word makefile, thanks to thiton) (recursively) and then launch make against it.

like image 198
Cédric Julien Avatar answered Sep 03 '26 02:09

Cédric Julien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!