Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I do a search of all directories calles i18n under trees like src/main/resources using find or any other unix command.

Everything I'm trying doesn't work

I'm looking for something like:

$find . -name 'src/main/resources/i18n/ -type d

But directory './foo/src/test/resources/i18n' should not appear.

share|improve this question
"everything I'm trying" is not very useful. What have you tried? – user 99572 is fine Feb 18 '13 at 11:24
I've already found the correct option. – Alfergon Feb 18 '13 at 11:41
up vote 1 down vote accepted

Found it at last:

find -type d -regex ".*src/main/resources/i18n"
share|improve this answer

You're almost there. Specify the common root dir of all your trees instead of .

find common/root/dir/ -type d -name i18n

(You can specify an absolute path there of course.)

share|improve this answer
This isn't working – Alfergon Feb 18 '13 at 9:56
Could you be more specific about that? – Karma Fusebox Feb 18 '13 at 9:57
$ find src/main/resources/ -type d -name i18n find: src/main/resources/: No such file or directory – Alfergon Feb 18 '13 at 9:58
Ah, yes. I slightly misunderstood your question. See my edit, in your case the common root seems to be . but you need to use only "i18n" with -name, not the rest of the paths as well. – Karma Fusebox Feb 18 '13 at 10:02
Yes, I also tried that, but that gives me both the 'src/main/resources/i18n' and the 'src/test/resources/i18n' that I don't need. – Alfergon Feb 18 '13 at 10:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .