tags:

views:

178

answers:

3

Is there a way to use "install" for installing multiple files at once using a "wildcard" pattern (and still have "install" create the leading directory hierarchy)?

I've tried several different ways:

  • install -D -t /dest/path /source/path/*.py
  • install -D -t /dest/path/ /source/path/*.py
  • install -D /source/path/*.py /dest/path
  • install -D /source/path/*.py /dest/path/

Please help... for each trial it takes a lot of time (I am using pbuilder to test my package each time).

A: 

Inserting the following to create the directory hierarchy prior to installing:

@install -d /dest/path

and then using:

@install -D /source/path/*.py /dest/path

to "install" all the files

jldupont
+1  A: 

Maybe use a simple outer for loop around the install call? So how about

for f in /source/path/*.py; do \
    install -D -t /dest/path $$f; \
done

That said, you can always take the logic out of your Makefile, debian/rules file, ... and test it standalone without having to run pbuilder.

Otherwise of course props for using pbuilder for internal projects!

Dirk Eddelbuettel
jldupont
@Dirk: I'll accept your answer even though I went for a more direct solution IMO. But hey, there are many ways to go about it. Cheers.
jldupont
Yes, you response is pretty good too. Do you actually create .deb packages? In that case dh_installdirs is super-easy -- just list what directories you need and you're done. Debhelper has many useful tools.
Dirk Eddelbuettel
A: 

man install shows that the DEST must be existing if copy multiple files.

... In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to the existing DIRECTORY, while setting permission modes and owner/group. In the 4th form, create all components of the given DIRECTORY(ies). ...

Dyno Fu
... thanks I have already read the "man" file...
jldupont