# Problem with the command Dir.entries

**URL:** <https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147>\
**Category:** Help & Support\
**Created:** [December 15, 2021, 10:58pm UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147 "2021-12-15T22:58:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [December 15, 2021, 10:58pm UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147/1 "2021-12-15T22:58:29Z")

</div>

Hello, today I used Dir.entries functionnality to list files into a directory, but I seen a problem, this fonction take as well hidden files. How can I prevent that ? Can I had a filter or something like that ?

---

<div class="post-metadata">

**Author:** ![stakach](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/stakach/32/58_2.png) [@stakach](https://forum.crystal-lang.org/u/stakach)\
**Post date:** [December 16, 2021, 6:27am UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147/2 "2021-12-16T06:27:15Z")

</div>

this should work?

```auto
Dir.entries("/my-dir").reject! &.starts_with?('.')

```

---

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [December 16, 2021, 10:25am UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147/3 "2021-12-16T10:25:45Z")

</div>

This work, thanks you !

But what is this syntax ??? Specially that:

`&.starts_with?('.')`

---

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [December 16, 2021, 11:11am UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147/4 "2021-12-16T11:11:25Z")

</div>

[https://crystal-lang.org/reference/1.2/syntax\_and\_semantics/blocks\_and\_procs.html#short-one-parameter-syntax](https://crystal-lang.org/reference/1.2/syntax_and_semantics/blocks_and_procs.html#short-one-parameter-syntax)

---

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [December 16, 2021, 11:27pm UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147/5 "2021-12-16T23:27:57Z")

</div>

Oh yes I forgot that. Thanks you !

---

<div class="post-metadata">

**Author:** ![Fryguy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fryguy/32/1181_2.png) [@Fryguy](https://forum.crystal-lang.org/u/Fryguy)\
**Post date:** [December 19, 2021, 4:19pm UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147/6 "2021-12-19T16:19:14Z")

</div>

If all you are trying to remove is just `"."` and `".."`, prefer `Dir.children` instead.

---

<div class="post-metadata">

**Author:** ![Fulgurance](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/fulgurance/32/1463_2.png) [@Fulgurance](https://forum.crystal-lang.org/u/Fulgurance)\
**Post date:** [December 21, 2021, 9:59am UTC](https://forum.crystal-lang.org/t/problem-with-the-command-dir-entries/4147/7 "2021-12-21T09:59:57Z")

</div>

Oh yes perfect, thanks you
