Last Updated: February 25, 2016
·
935
· ranman

How to run a command in every directory below your current directory

find . -type d \( ! -name . \) -maxdepth 1 -exec sh -c '(cd {} && git init)' ';'

2 Responses
Add your response

Wow! I really liked the depth you went into on the explanation of this command. Such clarity. Much description. Very maxdepth.

over 1 year ago ·

+1 to tylerbrock.

If you're not familiar with each of those commands and don't want to run code blindly, this is pretty cool: http://explainshell.com/

over 1 year ago ·