Execute a command w/wildcards & recursive descent
BURNS,JIM
gt0178a at prism.gatech.EDU
Sun Sep 2 07:46:59 AEST 1990
in article <1990Sep01.154949.16559 at chinet.chi.il.us>, les at chinet.chi.il.us (Leslie Mikesell) says:
> Unless there is some requirement to do a single directory at a time you
> could use:
>
> find . -type f -name 'wildcard' -print | xargs command
Yeah, I guess I was getting to hung up on the order. Thanx.
For those who are interested tho', I did play with it some more, and got
the script below to work the same way as the 'c' program, and it executes
in 1/2 to 3/4 the time (according to the ksh time command), and is 100th
the size and works on BSD - go figure!
-rwxr-xr-x 1 gt0178a 290 Sep 1 17:07 ftw*
-rwxr-xr-x 1 gt0178a 23949 Aug 27 20:16 ftw2*
startdir=$1;shift
for i in `du $startdir|awk '{print $2}'`;do
(cd $i
echo '****************************************'
echo -n "in $i do ";set -f;echo $*;set +f
echo '****************************************'
eval $*
return=$?
echo ""
echo Command return code = $return
echo "";echo "")
done
--
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a at prism.gatech.edu
More information about the Comp.unix.questions
mailing list