Doing more than one thing at once with find(1)
Jerry Peek
jdpeek at rodan.acs.syr.edu
Fri Mar 23 20:12:55 AEST 1990
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 at rodan.acs.syr.edu, JDPEEK at SUNRISE.BITNET +1 315 443-3995
More information about the Comp.unix.questions
mailing list