# File GLOB\_RECURSE incorrectly filters directories

**URL:** <https://discourse.cmake.org/t/file-glob-recurse-incorrectly-filters-directories/4930>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [January 29, 2022, 7:56am UTC](https://discourse.cmake.org/t/file-glob-recurse-incorrectly-filters-directories/4930 "2022-01-29T07:56:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ixsci](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ixsci/32/2041_2.png) [@ixsci](https://discourse.cmake.org/u/ixsci)\
**Post date:** [January 29, 2022, 7:56am UTC](https://discourse.cmake.org/t/file-glob-recurse-incorrectly-filters-directories/4930/1 "2022-01-29T07:56:49Z")

</div>

I have the following dir [sub]structure:

```auto
├── src
│ ├── Mistery
│ │ ├── IntegrationTests
│ │ └── mistery.txt
│ ├── SomeFolder
│ │ └── AnotherFolder
│ └── UnitTests

```

And I try to find all directories which end with “Tests”. Here is a small cmake code for that:

```cmake
file(GLOB_RECURSE TEST_FOLDERS LIST_DIRECTORIES true RELATIVE "${CMAKE_SOURCE_DIR}" src/*Tests)
message("Folders: ${TEST_FOLDERS}")

```

And here is the output:

> Folders: src/Mistery;src/Mistery/IntegrationTests;src/SomeFolder;src/SomeFolder/AnotherFolder;src/UnitTests

As you can see instead of returning all the directories which end with “Tests” it just returned all the directories it found, the only thing it filtered out is the `mistery.txt` file. What am I doing wrong?
