Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!usc!snorkelwacker!apple!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.questions Subject: Re: Execute a command w/wildcards & recursive descent Keywords: find lsr recursive descent Message-ID: <1990Sep01.154949.16559@chinet.chi.il.us> Date: 1 Sep 90 15:49:49 GMT References: <13204@hydra.gatech.EDU> Organization: Chinet - Chicago Public Access UNIX Lines: 24 In article <13204@hydra.gatech.EDU> gt0178a@prism.gatech.EDU (BURNS,JIM) writes: >Listed below is a 'C' program I wrote because I got tired of 'ls -R' and >'find' not understanding wildcards, even if quoted. Can anyone tell me how >to do something like >find . -type d -exec 'general command with wildcards and {}' \; Unless there is some requirement to do a single directory at a time you could use: find . -type f -name 'wildcard' -print | xargs command xargs reads stdin for newline-delimited filenames and bundles them in groups to pass on the command line to one or more executions of "command". This is typically used to avoid the "argument list too long" problem when you let the shell expand wildcards on an unknown number of files. Of course if the list will never exceed the shell command line buffer and you know how deep the directory tree goes, you can just use: command * */* */*/* (etc..) Les Mikesell les@chinet.chi.il.us