# Include all files from folder

**URL:** <https://discourse.julialang.org/t/include-all-files-from-folder/77475>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [March 6, 2022, 1:55pm UTC](https://discourse.julialang.org/t/include-all-files-from-folder/77475 "2022-03-06T13:55:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [March 6, 2022, 1:55pm UTC](https://discourse.julialang.org/t/include-all-files-from-folder/77475/1 "2022-03-06T13:55:46Z")

</div>

Hello,  
I can import a file into the Julia environment with `include("path/file.jl")`. Is it possible to include all the files present in “path”? `include("path/*.jl")` does not work…  
Thanks

---

<div class="post-metadata">

**Author:** ![hexaeder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hexaeder/32/24403_2.png) [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Post date:** [March 6, 2022, 3:19pm UTC](https://discourse.julialang.org/t/include-all-files-from-folder/77475/2 "2022-03-06T15:19:35Z")

</div>

You could use

```julia
include.(filter(contains(r".jl$"), readdir(dir; join=true)))

```

which lists the absolute pathes of all files in `dir`, filters for files with end with `.jl` and includes them one by one.

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [March 6, 2022, 5:39pm UTC](https://discourse.julialang.org/t/include-all-files-from-folder/77475/3 "2022-03-06T17:39:10Z")

</div>

For a wildcard-based solution (and if you’re willing to add a dependency for this), you can use the `Glob` package:

```julia
foreach(include, glob("*.jl", dir))

```

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [March 7, 2022, 11:21am UTC](https://discourse.julialang.org/t/include-all-files-from-folder/77475/4 "2022-03-07T11:21:41Z")

</div>

Note that this works only if the files are independent since the order of the includes may vary between systems. To save you future headache I suggest that you list the includes explicitly.
