# File Listing Order

**URL:** <https://discourse.processing.org/t/file-listing-order/7148>\
**Category:** Coding Questions\
**Created:** [January 4, 2019, 4:43am UTC](https://discourse.processing.org/t/file-listing-order/7148 "2019-01-04T04:43:52Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [January 4, 2019, 2:01pm UTC](https://discourse.processing.org/t/file-listing-order/7148/17 "2019-01-04T14:01:48Z")

</div>

> [@Architector\_4](#):
>
> Hold on, why do we check if a directory `.isDirectory()` if we know that it’s a directory?

From the original forum question:

> [@How to check if a file is exist in data folder by code?](https://discourse.processing.org/t/how-to-check-if-a-file-is-exist-in-data-folder-by-code/589):
>
> I have to check if a file is exist in data folder while the code is running. How to achieve that function?

The `if dir.isDirectory():` check block was intended to assure 1st whether the sketch’s “data/” folder already existed before proceeding any further. 😳

---

_[View the full topic](https://discourse.processing.org/t/file-listing-order/7148)._
