linux 中find命令限制仅在当前一级目录进行查找

发布时间 2023-09-22 09:08:01作者: 小鲨鱼2018

 

001、-maxdepth 1

[root@pc1 dir001]# ls
test01  test02  ww.txt  xx.map
[root@pc1 dir001]# find ./ -name "*.txt"       ## 直接查找
./test01/kk.txt
./test02/mm.txt
./test02/dirxx/diryy/tt.txt
./ww.txt
[root@pc1 dir001]# find ./ -maxdepth 1 -name "*.txt"    ## 限定仅在当前一级目录
./ww.txt

 

。