Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a deb-file and enumerating the files and paths I need to have in the package using the install file. It looks like

dir1/* path1
dir2/* path2

But in a result deb-file there are no hidden files from dir1 and dir2. It looks like * doesn't match hidden files.

How could I match them apart from specifying each one explicitly?

share|improve this question
I think "dir1/.* path1" would work but I'm unsure – porton Jan 28 '13 at 20:18
@porton: In that case I will have only hidden files right under dir1 copied. This won't include not-hidden ones and hidden files from nested directories – zerkms Jan 28 '13 at 20:19
@zerkms This is using dh_install? – jordanm Jan 28 '13 at 20:24
@jordanm: yep.. – zerkms Jan 28 '13 at 20:26
side note: it's unusual to package dotfiles. – jordanm Jan 28 '13 at 20:33
up vote 2 down vote accepted

The globs used by dh_install are perl globs, which are modeled after csh globs. These do not match hidden files by default. In order to get all files, including hidden files, you will need to use two globs. Here is an example:

dir1/.* path1
dir1/* path1

Update: It has been pointed out in comments to this answer that .* matches . and ... Since perl's globbing doesn't offer anything to avoid this situation, the dotfiles will need to be added explicitly.

dir1/.htaccess path1
share|improve this answer
It leads to cp: cannot copy a directory, ./public/.., into itself, error – zerkms Jan 28 '13 at 21:01
dir/.* is horrible as it includes . and ... Try dir/.??* – Dennis Kaarsemaker Jan 28 '13 at 21:04
@Dennis Kaarsemaker: dir/.??* will not match say .a, but anyway, thanks for the help - I decided to specify that single file explicitly – zerkms Jan 28 '13 at 21:06
@zerkms - I updated the answer based on these comments. – jordanm Jan 28 '13 at 21:07
seriously? .a? What crackpot software is so braindead that it uses filenames this non-descriptive? – Dennis Kaarsemaker Jan 28 '13 at 21:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.