Reputation: 6856
I have this directory structure
$ tree test
test
├── test1
│ ├── test11
│ │ └── file.txt
│ ├── test12
│ │ └── file.txt
│ └── test13
│ └── file.txt
├── test2
│ └── file.txt
└── test3
└── file.txt
6 directories, 5 files
and I want a find command that will return
$ 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
So basically search for file.txt
only in directories test/test1
and test/test3
. To get this going I tried this
$ find test \( -path './test3/*' -o -path './test2/*' \) -name file.txt
but it returns nothing.
Upvotes: 0
Views: 27
Reputation: 176
Seems this answer could help you https://unix.stackexchange.com/a/60850
For example: find test/test1 test/test3 -name file.txt
Upvotes: 2