Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the unix command to find files that are in one directly buy not another directory? I only care about file names.

Thanks.

share|improve this question
    
Well, I can say ls dir1 dir3 dir5. If that’s not what you’re looking for, please clarify your question. –  Scott Feb 26 '13 at 22:39

1 Answer 1

I'm assuming you want to do this search from a higher level directory. If so, you can use the -path option with find.

For example, given the directory structure below

+---dir1/test1.txt
  |
  |--dir2/test1.txt

to find files matching 'test*' in dir1 use

find -path '*dir1*' -iname 'test*'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.