find排除子目录命令
 
find 排除子目录的方法有很多,不过下面这个很强大。
01
[[email protected] 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
[[email protected] tkt]$ find . -name "*.txt" | head -5
08
./RPM/IN3329198.txt
09
./RPM/IN3353027.txt
10
./RPM/IN3247452.txt
11
./RPM/IN3242594.txt
maxdepth的写法:
 
1
[[email protected] tkt]$ find . -maxdepth 1 -name '*.txt'
2
./IN3930738.txt
3
./IN3913493.txt
4
./IN3958279.txt
5
./IN3939424.txt
6
./IN3785781.txt