# Open file in folder and subfolders

**URL:** <https://discourse.processing.org/t/open-file-in-folder-and-subfolders/17552>\
**Category:** Coding Questions\
**Created:** [February 4, 2020, 6:08pm UTC](https://discourse.processing.org/t/open-file-in-folder-and-subfolders/17552 "2020-02-04T18:08:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [February 4, 2020, 7:38pm UTC](https://discourse.processing.org/t/open-file-in-folder-and-subfolders/17552/2 "2020-02-04T19:38:58Z")

</div>

> [@plux](#):
>
> … open every file in a folder and in each subfolders (recursively)…

You can use **listPaths()** for it:  
[Processing.GitHub.io/processing-javadocs/core/processing/core/PApplet.html#listPaths-java.lang.String-java.lang.String…-](http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#listPaths-java.lang.String-java.lang.String...-)

And here’s an example for image files, which you can easily adapt for CSV 1s:

> [@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…

Don’t forget Processing can also load CSV & TSV files via **loadTable()**:

> **[loadTable() / Reference](https://processing.org/reference/loadTable_.html)**
>
> Reads the contents of a file or URL and creates a Table object with its values. If a file is specified, it must be located in the sketch's "data" folder. The filename parameter can also be a URL to a …

---

_[View the full topic](https://discourse.processing.org/t/open-file-in-folder-and-subfolders/17552)._
