Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shell find to not show root directory in search results

Tags:

linux

bash

shell

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.

like image 300
Blaise Avatar asked Feb 16 '23 19:02

Blaise


1 Answers

-mindepth 1 not working for you?

like image 67
akostadinov Avatar answered Mar 04 '23 18:03

akostadinov