How to run a command in every directory below your current directory
find . -type d \( ! -name . \) -maxdepth 1 -exec sh -c '(cd {} && git init)' ';'
Written by Joseph Randall Hunt
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Related Tags
#shell
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#