I am trying to find all directories in a folder recursively while exclude all git submodules by excluding all path containing .git
file. How could I do it?
Explanation:
.git
file exists at the root of every submodules folder. This submodule folder could be included anywhere.
Test Case
$ mkdir Test
$ cd Test
$ mkdir a
$ mkdir b
$ mkdir c
$ cd a
$ mkdir .git
$ cd ..
$ cd b
$ touch .git
$ cd ..
$ cd c
$ mkdir c1
$ mkdir c2
$ cd..
$ find . -type d \( \( ! -name . -exec [ -e {}/.git ] \; -prune \) -o \( \( \
-name .git\
-o -name .vscode\
-o -name node_modules\
-o -name Image\
-o -name Rendered\
-o -name iNotebook\
-o -name GeneratedTest\
-o -name GeneratedOutput\
\) -prune \) -o -print \) | sort
Expected Results
.
./a
./c
./c/c1
./c/c2
find "$(pwd)" -not \( -path "*/.git"\
) -type d` – Porcupine Sep 13 '18 at 08:46.git
file exist at the root of every submodules folder. This submodule folder could be included anywhere – Porcupine Sep 13 '18 at 08:47