Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!styx!ptsfa!ihnp4!chinet!steinmetz!davidsen From: davidsen@steinmetz.steinmetz.UUCP (William E. Davidsen Jr) Newsgroups: comp.unix.wizards Subject: Re: impossible problem for find(1)? Message-ID: <5900@steinmetz.steinmetz.UUCP> Date: Wed, 29-Apr-87 12:04:29 EDT Article-I.D.: steinmet.5900 Posted: Wed Apr 29 12:04:29 1987 Date-Received: Sat, 2-May-87 10:09:42 EDT References: <2645@phri.UUCP> Reply-To: davidsen@kbsvax.steinmetz.UUCP (William E. Davidsen Jr) Organization: General Electric CRD, Schenectady, NY Lines: 29 In article <2645@phri.UUCP> roy@phri.UUCP (Roy Smith) writes: > > A user posed a problem which I can't solve. She wants to find all >the files named *refs which are newer than a file called INDEX in the same >directory. Thus she wants to know if any of ./x/foorefs, ./x/barrefs or >./x/bazrefs is newer than ./x/INDEX, and if ./y/z/refs is newer than >./y/z/INDEX, etc. I can't think of how to do this with find, or even any >combination of find and any other standard tools. We're running MtXinu >4.3BSD/NFS on a Vax and Sun-3.1 on some Sun-3's. After looking at some of the solutions to this, I decided that my first thought was no more confusing and used something we all have, the Bourne shell. $ find . -type d -print | > while read dirname > do > find $dirname -name '*refs' -newer $dirname/INDEX -print > done Note that if you don't escape the "*refs" as some of the suggested solutions have (not) done, and you have a matching file in the current directory, you will get filename expansion and the find will fail. -- bill davidsen sixhub \ ARPA: wedu@ge-crd.arpa ihnp4!seismo!rochester!steinmetz -> crdos1!davidsen chinet / "Stupidity, like virtue, is its own reward"