[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Make action on all files in a dir recursively



Je 2001/09/01(6)/13:09, Konstantin V. Sorokin montris sian geniecon skribante:
> On Sat, Sep 01, 2001 at 12:52:45PM +0400, Ingvarr Zhmakin wrote:
> > Доброе утро.
> > 
> > Как бы попроще в bash сделать команду на все файлы в директории _рекурсивно_?
> > 
> >                    Ingvarr.
> 
> cd dir/
> for f in $(find); do echo $f; done

I don't understand russian, but it seems to me he wanted
to do something on files, not the directories:

for f in $(find $dir -type f); do echo $f; done

Or, if you want it to work too when there are *many* files
(above the bash comand line limit), then you probably have
to use:

find $dir -type f | xargs echo

or 

find $dir -type f | xargs -n 1 echo

(try to see the difference).
-- 
joostje



Reply to: