find排除子目錄命令
find 排除子目錄的方法有很多,不過下面這個很強大。
01
[nobody@oc8243606638 tkt]$ find . ! -name "." -type d -prune -o -type f -name "*.txt" -print
02
./IN3930738.txt
03
./IN3913493.txt
04
./IN3958279.txt
05
./IN3939424.txt
06
./IN3785781.txt
07
[nobody@oc8243606638 tkt]$ find . -name "*.txt" | head -5
08
./RPM/IN3329198.txt
09
./RPM/IN3353027.txt
10
./RPM/IN3247452.txt
11
./RPM/IN3242594.txt
maxdepth的寫法:
1
[nobody@oc8243606638 tkt]$ find . -maxdepth 1 -name '*.txt'
2
./IN3930738.txt
3
./IN3913493.txt
4
./IN3958279.txt
5
./IN3939424.txt
6
./IN3785781.txt