# Installing many files with dune

**URL:** <https://discuss.ocaml.org/t/installing-many-files-with-dune/4143>\
**Category:** Ecosystem\
**Tags:** dune\
**Created:** [July 24, 2019, 9:20am UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143 "2019-07-24T09:20:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanette](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/sanette/32/1645_2.png) [@sanette](https://discuss.ocaml.org/u/sanette)\
**Post date:** [July 24, 2019, 9:20am UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/1 "2019-07-24T09:20:57Z")

</div>

Hello,

The library that I am developing needs a certain number of additional files (config, images, fonts, etc.) that seem to fit well in the `share` directory. I would like to have `dune` install them automatically.

Basically, I want to do (taken from [https://dune.readthedocs.io/en/stable/installation.html](https://dune.readthedocs.io/en/stable/installation.html)):

```
(install
 (files hello.txt)
 (section share)
 (package mypackage))

```

but replacing `hello.txt` by a (large) number of files. What’s the best way to do this?  
I would be happy, for instance, if I could just indicate the name of the directory in order to select all its files.

---

<div class="post-metadata">

**Author:** ![ejgallego](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/ejgallego/32/239_2.png) [@ejgallego](https://discuss.ocaml.org/u/ejgallego)\
**Post date:** [July 24, 2019, 10:28am UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/2 "2019-07-24T10:28:58Z")

</div>

Hello @sanette !

I have similar needs and for now I’ve been using a script to generate the dune file, but indeed it is far from ideal. I don’t recall the exact situation w.r.t. globs , but for directories you can check the status at [https://github.com/ocaml/dune/issues/1868](https://github.com/ocaml/dune/issues/1868) , [https://github.com/ocaml/dune/issues/1377](https://github.com/ocaml/dune/issues/1377) , and [https://github.com/ocaml/dune/issues/256](https://github.com/ocaml/dune/issues/256)

---

<div class="post-metadata">

**Author:** ![SkySkimmer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/skyskimmer/32/1672_2.png) [@SkySkimmer](https://discuss.ocaml.org/u/SkySkimmer)\
**Post date:** [July 24, 2019, 10:35am UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/3 "2019-07-24T10:35:19Z")

</div>

Maybe with a glob [https://dune.readthedocs.io/en/latest/dune-files.html#glob](https://dune.readthedocs.io/en/latest/dune-files.html#glob)  
something like (files mydir/\*)  
I don’t know if install supports globs though

Gaëtan Gilbert

---

<div class="post-metadata">

**Author:** ![sanette](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/sanette/32/1645_2.png) [@sanette](https://discuss.ocaml.org/u/sanette)\
**Post date:** [July 24, 2019, 7:59pm UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/4 "2019-07-24T19:59:37Z")

</div>

Hi @SkySkimmer, it doesn’t seem to work.

```
$ dune build
File "lib/dune", line 9, characters 8-15:
9 | (files share/*))
            ^^^^^^^
Error: No rule found for lib/share/*
```

---

<div class="post-metadata">

**Author:** ![sanette](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/sanette/32/1645_2.png) [@sanette](https://discuss.ocaml.org/u/sanette)\
**Post date:** [July 24, 2019, 8:23pm UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/5 "2019-07-24T20:23:04Z")

</div>

Hi @ejgallego, thanks for the links. So obviously we are several of us with the same problem. I think that, at least until things evolve, I will also generate the dune file with a script.

---

<div class="post-metadata">

**Author:** ![vrotaru](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/vrotaru/32/39_2.png) [@vrotaru](https://discuss.ocaml.org/u/vrotaru)\
**Post date:** [July 25, 2019, 7:08am UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/6 "2019-07-25T07:08:33Z")

</div>

Shouldn’t it be

```auto
(files (glob mydir/*))

```

[Glob](https://dune.readthedocs.io/en/stable/dune-files.html?highlight=glob#glob) section for references

---

<div class="post-metadata">

**Author:** ![sanette](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/sanette/32/1645_2.png) [@sanette](https://discuss.ocaml.org/u/sanette)\
**Post date:** [July 25, 2019, 7:48am UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/7 "2019-07-25T07:48:03Z")

</div>

Hi @vrotaru, doesn’t seem to work either (at least with me)

```
File "lib/dune", line 9, characters 8-22:
9 | (files (glob share/*)))
            ^^^^^^^^^^^^^^
Error: invalid format, <name> or (<name> as <install-as>) expected
Hint: dune files require fewer parentheses than jbuild files.
If you just converted this file from a jbuild file, try removing these parentheses.
```

---

<div class="post-metadata">

**Author:** ![vrotaru](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/vrotaru/32/39_2.png) [@vrotaru](https://discuss.ocaml.org/u/vrotaru)\
**Post date:** [July 25, 2019, 8:48am UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/8 "2019-07-25T08:48:53Z")

</div>

My bad. I used `glob` in a similar context so I thought it may work here. It doesn’t.

---

<div class="post-metadata">

**Author:** ![ejgallego](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/ejgallego/32/239_2.png) [@ejgallego](https://discuss.ocaml.org/u/ejgallego)\
**Post date:** [July 25, 2019, 3:48pm UTC](https://discuss.ocaml.org/t/installing-many-files-with-dune/4143/9 "2019-07-25T15:48:23Z")

</div>

I am positive a solution will arrive soon!
