linux 中同时限定多个目录进行查找

 

001、不限制

[root@pc1 dir001]# ls       ## 测试目录文件
test01  test02  test03
[root@pc1 dir001]# tree
.
├── test01
│   ├── cc.csv
│   └── kk.txt
├── test02
│   ├── mm.txt
│   └── yy.csv
└── test03
    ├── ee.txt
    └── kk.csv

3 directories, 6 files
[root@pc1 dir001]# find ./ -name "*.txt"   ## 直接在当前目录查找
./test01/kk.txt
./test02/mm.txt
./test03/ee.txt

 

002、同时限定多个目录

[root@pc1 dir001]# ls
test01  test02  test03
[root@pc1 dir001]# tree  ## 测试目录文件
.
├── test01
│   ├── cc.csv
│   └── kk.txt
├── test02
│   ├── mm.txt
│   └── yy.csv
└── test03
    ├── ee.txt
    └── kk.csv

3 directories, 6 files
[root@pc1 dir001]# find /home/dir001/test01 /home/dir001/test02/ -name "*.txt"     ## 限定两个目录
/home/dir001/test01/kk.txt
/home/dir001/test02/mm.txt

 

 

posted @ 2023-09-22 08:53  小鲨鱼2018  阅读(106)  评论(0编辑  收藏  举报