I got one probably silly question:
I'm working on remote server under Solaris using ssh and my task is to find specific files in directories matching shell pattern but not go recursively deeper.
Suppose I have following directory hierarchy:
dir-a/ file-a file-b dir-c/ file-a dir-b/ file-a file-b and I want to find all files named file-a in directories dir-a & dir-b but not in directory dir-c. Ok, so far so good - it's really simple with single find command:
find dir-{a,b} -mindepth 1 -maxdepth 1 -name 'file-a' but the problem is that on this machine installed really old version of find so it doesn't has -mindepth and -maxdepth options. I tried to use -prune:
find dir-{a,b} \( -type d -prune \) -o -name file-a -print but it prints nothing at all cause very first directories in search tree are dir-a and dir-b themselves so find just skip their contents as it actually should. If I could use -mindepth I would merely skip this "root" directories with -mindepth 1 and get another working solution, but as I said I can't. depth didn't help also because dir-a and dir-b are last in find search tree if it used and dir-a/dir-c/file-a is now again in output. Oh and this old find also hasn't -regex and -wholepath option so I can't use complex name patterns to exclude deeper files form results. Do you have any assumptions?