Blaise
Blaise

Reputation: 7518

shell find to not show root directory in search results

I have a quick and prehaps easy to solve problem. I was listing a directories list via

find ~/me/ -maxdepth 1 -type d -not -name "test1" -and -not -name "test4"

$ find ~/me/ -maxdepth 1 -type d -not -name "test1" -and -not -name "test4"
/home/me/
/home/me/test2
/home/me/test3

I want to use something like: find ~/me/ -maxdepth 1 -type d -not -name "test1" -and -not -name "test4" | xargs rm -rf, however the find shows me the: /home/me root dir.

I was looking for a way to not include it in the search results. Any hints? Thanks in advance.

Upvotes: 4

Views: 1656

Answers (1)

akostadinov
akostadinov

Reputation: 18634

-mindepth 1 not working for you?

Upvotes: 9

Related Questions