# A bit of strange behaviour

**URL:** <https://racket.discourse.group/t/a-bit-of-strange-behaviour/3587>\
**Category:** General\
**Created:** [February 25, 2025, 2:25pm UTC](https://racket.discourse.group/t/a-bit-of-strange-behaviour/3587 "2025-02-25T14:25:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iobates](https://avatars.discourse-cdn.com/v4/letter/i/f07891/32.png) [@iobates](https://racket.discourse.group/u/iobates)\
**Post date:** [February 25, 2025, 2:25pm UTC](https://racket.discourse.group/t/a-bit-of-strange-behaviour/3587/1 "2025-02-25T14:25:37Z")

</div>

I was just doing some small stuff with racket, was looking through files on a nas.  
The thing I found strange was

In drracket  
I was trying

> (define root "/some/dir/that/exists/with/files/and/folders")  
> (define files (directory-list root))  
> (for/list ([f files])  
> (if (directory-exists? f)  
> this branch won't run  
> this branch will run)

the same happens if I use file-exists?  
however if I do it not on the nas (cifs), on the local file system (ext4) it behaves as expected.  
I think it might be something with a different file system, not that I really know.

---

<div class="post-metadata">

**Author:** ![gus-massa](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gus-massa/32/507_2.png) [@gus-massa](https://racket.discourse.group/u/gus-massa)\
**Post date:** [February 25, 2025, 3:31pm UTC](https://racket.discourse.group/t/a-bit-of-strange-behaviour/3587/2 "2025-02-25T15:31:51Z")

</div>

You must use `(directory-list root #:build? #t)` to get the complete path instead just the name of the file/directory.

```scheme
#lang racket
(define root "/some/dir/that/exists/with/files/and/folders")
(define files (directory-list root #:build? #t))
(for ([f files])
  (display f)
  (if (directory-exists? f)
      (displayln " --> Yes")
      (displayln " --> No")))

```

---

<div class="post-metadata">

**Author:** ![iobates](https://avatars.discourse-cdn.com/v4/letter/i/f07891/32.png) [@iobates](https://racket.discourse.group/u/iobates)\
**Post date:** [February 25, 2025, 3:34pm UTC](https://racket.discourse.group/t/a-bit-of-strange-behaviour/3587/3 "2025-02-25T15:34:16Z")

</div>

Ah I just tested it on a single file in my directory, not the same for/list construct. Thanks will test this 🙂
