How to exclude this / current / dot folder from find “type d”

后端 未结 4 1946
一向
一向 2020-11-30 19:38
find . -type d

can be used to find all directories below some start point. But it returns the current directory (.) too, which may be

4条回答
  •  难免孤独
    2020-11-30 20:19

    Not only the recursion depth of find can be controlled by the -maxdepth parameter, the depth can also be limited from “top” using the corresponding -mindepth parameter. So what one actually needs is:

    find . -mindepth 1 -type d
    

提交回复
热议问题