Linux `只在某些子目录中查找`
我有这个目录结构Linux `只在某些子目录中查找`,linux,find,Linux,Find,我有这个目录结构 $ tree test test ├── test1 │ ├── test11 │ │ └── file.txt │ ├── test12 │ │ └── file.txt │ └── test13 │ └── file.txt ├── test2 │ └── file.txt └── test3 └── file.txt 6 directories, 5 files 我需要一个返回的find命令 $ find test
$ tree test
test
├── test1
│ ├── test11
│ │ └── file.txt
│ ├── test12
│ │ └── file.txt
│ └── test13
│ └── file.txt
├── test2
│ └── file.txt
└── test3
└── file.txt
6 directories, 5 files
我需要一个返回的find命令
$ find test -constrain_to_paths test/test{13} -name file.txt
test/test3/file.txt
test/test1/test11/file.txt
test/test1/test12/file.txt
test/test1/test13/file.txt
因此,基本上只在目录test/test1
和test/test3
中搜索file.txt
。为了让这一切继续下去,我试过这个
$ find test \( -path './test3/*' -o -path './test2/*' \) -name file.txt
但是它什么也不返回。这个答案似乎对你有帮助
例如:
find test/test1 test/test3-name file.txt
这个答案似乎可以帮助您
例如:
find test/test1 test/test3-name file.txt
欢迎使用SO。非常感谢!对于后代来说,我最终使用的确切命令是findtest\(-path'test/test3/*'-或-path'test/test1/*'\)-和-name file.txt
Welocome to SO。非常感谢!对于后代来说,我最终使用的确切命令是findtest\(-path'test/test3/*'-或-path'test/test1/*'\)和-name file.txt