Looking in Folders and Building Arrays of contents on program startup

Hello,

I Have been reviewing this page on listing the contents of directories and sub directories
Processing Directory List

My question now is how to work with this data effectively once gathered. I say “effectively” because most of the documentation about parsing strings I have seen seem to be about working with big data files. I just imagine what I am trying do must be pretty common, and already well solved. I have just not been able to find any good examples.

My plan is to have a folder inside data, with more folders inside that of my art files. Some will be still images, some will be frames of animation. I plan to make a folder per animation with the relevant frames inside. So my directory structure may be something like:
…data/Art/Stills
…data/Art/Anims/Cow
…data/Art/Anims/Car
…data/Art/Anims/Worm
…etc.

So “Stills” would a folder of images that should be loaded into one Array.

the Anim folders should have their contents loaded into an Array each.

For testing purposes I have been hardcoding my arrays. All that is working just fine. I would like to be able to freely drop new content in these folders and have everything be loaded when I run the program.

Thanks in advance for any help or direction you can provide.

Toof

If you do not find a post in the Processing forum that suits your need, you can try stackoverflow. What you are trying to do is related to Java and not strictly to Processing. In other words, whatever solution you find in pure Java world, you can use it directly in Processing. For example, check this.

You will need to get each file’s full path, parse the folder structure and manage the files based on their path. This can be done easily based on the description that you provided above. Good luck!

Kf

1 Like