I already saw the question: Finding subdirectories inside all directories with the same name
Now my directory structure is:
$ find .
.
./4
./4/1
./2
./2/1
./5
./5/1
./1
./1/1
./3
./3/1
I want to list all the directories at the end with "1" in their name:
./4/1
./2/1
./5/1
./1/1
./3/1
but I don't want
./1
I have tried the following commands:
find . -name "*1*"
find . -type d -path '*/1*'
find . -path '*/1*' -depth 2 -type d
find . -depth 2 -path '*/1*' -type d
UPDATE
find . -depth 2
gives the error:
find: paths must precede expression: 2
Found my solution
find -mindepth 2 . -type d -path "*1*"
Can anybody explain why -depth didn't work while -mindepth worked ?