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

后端 未结 4 1945
一向
一向 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:03

    I use find ./* <...> when I don't mind ignoring first-level dotfiles (the * glob doesn't match these by default in bash - see the 'dotglob' option in the shopt builtin: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html).

    eclipse tmp # find .
    .
    ./screen
    ./screen/.testfile2
    ./.X11-unix
    ./.ICE-unix
    ./tmux-0
    ./tmux-0/default
    
    eclipse tmp # find ./*
    ./screen
    ./screen/.testfile2
    ./tmux-0
    ./tmux-0/default
    

提交回复
热议问题