Julian Gilbey <[EMAIL PROTECTED]> writes:

> > Alexander Koch wrote:
> > > I have a source which has "samples/admin/" as a dir.
> > > Now I want to have a simple
> > > install -m 644 samples/* $(tmp)/usr/doc/$(pkg)/examples
> > > without touching the admin/ subdir at all.
> > > 
> 
> Assuming that this is in a Makefile (as hinted by $(pkg), you want
> this to read (remembering initial tabs):
> 
>       for file in `find samples -type f`; do \
>               install -m 644 $$file $(tmp)/usr/doc/$(pkg)/examples; \
>       done
> 
> with a *double* dollar before file.

Of course, if you don't actually want to recurse, but just want the
files in the top level of the samples directory (I'm assuming you want 
to preserve the structure there):

        for file in `find samples/* -type f -print -type d -prune`; do \
                install -m 644 $$file $(tmp)/usr/doc/$(pkg)/examples; \
        done


Or even:
        for dir in `find samples -type d -print`; do
                install -d -m 755 $(tmp)/usr/doc/$(pkg)/examples/`echo $$dir | 
sed 's/^samples\///'`; \
        done
        for file in `find samples -type f -print`; do \
                install -m 644 $$file $(tmp)/usr/doc/$(pkg)/examples/`echo 
$$file | sed 's/^samples\///'`; \
        done

Which preserves the directory structure.  Of course if there are only
a few directories, it's simpler to do

        install -d -m 755 $(tmp)/usr/doc/$(pkg)/examples/admin
        install -d -m 755 $(tmp)/usr/doc/$(pkg)/examples/otherdir

And then:
        for file in `find samples/* -type f -print -type d -prune`; do \
                install -m 644 $$file $(tmp)/usr/doc/$(pkg)/examples; \
        done
        for file in `find samples/admin/* -type f -print -type d -prune`; do \
                install -m 644 $$file $(tmp)/usr/doc/$(pkg)/examples/admin; \
        done
        for file in `find samples/otherdir/* -type f -print -type d -prune`; do 
\
                install -m 644 $$file $(tmp)/usr/doc/$(pkg)/examples/otherdir; \
        done

Reply via email to