Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!rodan!rodan.acs.syr.edu!jdpeek From: jdpeek@rodan.acs.syr.edu (Jerry Peek) Newsgroups: comp.unix.questions Subject: Doing more than one thing at once with find(1) Message-ID: <2578@rodan.acs.syr.edu> Date: 23 Mar 90 10:12:55 GMT Sender: jdpeek@rodan.acs.syr.edu Reply-To: jdpeek@rodan.acs.syr.edu (Jerry Peek) Organization: Syracuse University, Syracuse, NY Lines: 23 I've been using UNIX for almost ten years, and I never realized that find(1) could do more than one kind of operation as it works through a directory tree. It's in the man page, I guess, but I never figured it out... For instance, if I was setting modes on a bunch of directories and files, I'd do the directories with "find . -type d -exec chmod 700 {} \;" then I'd do the files with "find . -type f -exec chmod 600 {} \;". (Well, actually, I use xargs(1) too, but that's another story.) Tonight I found that this (long command line) does it all in one pass: $ find . \( -type f -exec chmod 600 {} \; \) -o \ \( -type d -exec chmod 700 {} \; \) Even though I've found this, and it seems to work, I still don't completely understand it. It's sort of like trying to program the Bourne shell just by reading the sh(1) man page. :-) [:-( ?] How about some useful examples of this? Post or e-mail, though posting might help other unenlightened geeks like me. :-) I'd be glad to summarize e-mail I get, if you ask. Thanks... --Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY jdpeek@rodan.acs.syr.edu, JDPEEK@SUNRISE.BITNET +1 315 443-3995