# Very basic file reading question - where is the data directory?

**URL:** <https://discourse.processing.org/t/very-basic-file-reading-question-where-is-the-data-directory/25119>\
**Category:** Beginners\
**Created:** [November 1, 2020, 3:46pm UTC](https://discourse.processing.org/t/very-basic-file-reading-question-where-is-the-data-directory/25119 "2020-11-01T15:46:31Z")\
**Posts on this page:** 1\
**Showing post:** 9

<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:** [November 1, 2020, 7:24pm UTC](https://discourse.processing.org/t/very-basic-file-reading-question-where-is-the-data-directory/25119/9 "2020-11-01T19:24:09Z")

</div>

> [@MuddyGardener](#):
>
> … says that **loadImage()** etc will only work on files in the data directory.

- By default Processing looks for a filename at the **sketchPath()** 1st.
- Only if it doesn’t find it there it looks at **dataPath()**.
- By default Processing saves everything on the **sketchPath()**.
- Wrap a filename on **dataPath()** in order to save it on subfolder “data/”.

An example sketch using **dataFile()** + **listPaths()**:

> [@File Listing Order](https://discourse.processing.org/t/file-listing-order/7148/41):
>
> [Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/Arrays.html#sort(java.lang.Object[])](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/util/Arrays.html#sort(java.lang.Object%5B%5D)) static final String PICS\_EXTS = "extensions=,png,jpg,jpeg,gif,tif,tiff,tga,bmp,wbmp"; static final float FPS = .25; PImage[] images; void setup() { size(1200, 600); frameRate(FPS); imageMode(CENTER); final File dir = dataFile(""); println(dir); String[] imagePaths = {}; int imagesFound = 0; if (dir.isDirectory()) { imagePaths = listPaths(dir.getPath(), "files", "recursi…

---

_[View the full topic](https://discourse.processing.org/t/very-basic-file-reading-question-where-is-the-data-directory/25119)._
