# Can't access subfolder's in a processing project

**URL:** https://discourse.processing.org/t/cant-access-subfolders-in-a-processing-project/25527
**Category:** Processing.py
**Created:** [November 19, 2020, 8:56am UTC](https://discourse.processing.org/t/cant-access-subfolders-in-a-processing-project/25527 "2020-11-19T08:56:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cornedb2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/cornedb2/32/11142_2.png) [@cornedb2](https://discourse.processing.org/u/cornedb2)
#### Post date: [November 19, 2020, 8:56am UTC](https://discourse.processing.org/t/cant-access-subfolders-in-a-processing-project/25527/1 "2020-11-19T08:56:33Z")

</div>

Hello,

I’m new to processing with Python and I want to access subfolders in my data folder with my processing project. If I loop through the folders with os.listdir(), only see the main.pyde. I’ve already tried dataPath and dataFile but without success.

My current folder structure is:  
main.pyde  
sketch.properties  
data

- Subfolder1
- Subfolder2
- Subfolder3

Kind Regards,

Corné

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [November 19, 2020, 9:53am UTC](https://discourse.processing.org/t/cant-access-subfolders-in-a-processing-project/25527/2 "2020-11-19T09:53:15Z")

</div>

Hi,

Welcome to the forum! 😉

I have this folder structure :

```auto
.
├── data
│ ├── folder_1
│ └── folder_2
├── sketch.properties
└── test_python.pyde

```

I tested this code :

```auto
import os

def setup():
    print(os.listdir("./data"))
    
def draw():
    pass

```

And it works :

```auto
['folder_1', 'folder_2']

```

But be sure to save your file before running, it was not updating in my case so at the beginning I thought it was not working properly.

And also your error might be that you omitted to put the `data` folder inside the path, I know that in Processing Java the relative path is in the data folder but maybe in python it’s not the case…

---

<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 20, 2020, 2:10am UTC](https://discourse.processing.org/t/cant-access-subfolders-in-a-processing-project/25527/3 "2020-11-20T02:10:10Z")

</div>

> [@cornedb2](#):
>
> I’ve already tried **dataPath()** and **dataFile()** but without success.

> [@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/7):
>
> Yes! Just pass an empty string "" to dataPath(): dataFolderPath = this.dataPath('') + '/' print dataFolderPath … or to dataFile(): dir = this.dataFile('') dataFolderPath = dir.path + '/' print dataFolderPath However, if you need all files within the sketch’s “data/” folder, like all images for example, you can use listPaths(), passing the “data/” folder path + a string w/ all desired “extensions=,”: sunglasses PICS\_EXTS = 'extensions=,png,jpg,jpeg,gif,tif,tiff,tga,bmp,wbmp' dir = this.…
