# Rdir: search recursive for files with a given name pattern

**URL:** <https://discourse.julialang.org/t/rdir-search-recursive-for-files-with-a-given-name-pattern/75605>\
**Category:** New to Julia\
**Tags:** question, filesystem\
**Created:** [February 1, 2022, 9:23pm UTC](https://discourse.julialang.org/t/rdir-search-recursive-for-files-with-a-given-name-pattern/75605 "2022-02-01T21:23:19Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [February 10, 2022, 6:50am UTC](https://discourse.julialang.org/t/rdir-search-recursive-for-files-with-a-given-name-pattern/75605/21 "2022-02-10T06:50:46Z")

</div>

> [@rafael.guerra](#):
>
> If I am not mistaken, […]

Confirmed, you are not mistaken! - @rafael.guerra Thanks!

But the initial reason for my post is still open, why does the statement “`global s_files`” in my initial function does the opposite from what is expected, that it is not necessary in this situation is one thing, but that it does the opposite from what I would like to achieve (that it is made global over the whole function space) is strange to me.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 10, 2022, 8:02am UTC](https://discourse.julialang.org/t/rdir-search-recursive-for-files-with-a-given-name-pattern/75605/22 "2022-02-10T08:02:55Z")

</div>

`global s_files` would refer to the module scope outside the `rdir()` function, but this variable is there empty / not defined.

Local variables defined inside a function can be used inside the inner scope of for loops, annotating them as global would have the meaning above. But I might well be wrong.

[Previous page](https://discourse.julialang.org/t/rdir-search-recursive-for-files-with-a-given-name-pattern/75605.md?page=1)
