FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   Get the content of the data folder
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Get the content of the data folder  (Read 2627 times)
gabon

WWW
Get the content of the data folder
« on: Dec 7th, 2004, 7:22pm »

is there a code to do that? working with images it could be nice to read all the images in the folder.
 
Thx, chr
 
st33d

WWW Email
Re: Get the content of the data folder
« Reply #1 on: Dec 8th, 2004, 1:57am »

HA HA HA HA!
 
Sorry, posted a half baked reply with a request for more help but I have a concise answer for you now. Look at the post by inadaze for accessing current directory information where I've answered there.
 
The example program I'm using is called fman2 (file manager 2, because I answered inadaze's query on saving files to a location, which first which may require some system information that Java is happy to pony up)
 
Just change fman2 in my example to your code folder and dump some stuff in there to see if it works.
 
Code:

File dir = new File("sketchbook/default/fman2/data");
     
String[] children = dir.list();
if (children == null) {
// Either dir does not exist or is not a directory
} else {
 for (int i=0; i<children.length; i++) {
// Get filename of file or directory
String filename = children[i];
println(children[i]);
}
}

 
I found this code here:
 
http://javaalmanac.com/egs/java.io/GetFiles.html?l=rel
 
There's some helpful permutations at this URL too. Enjoy.
« Last Edit: Dec 8th, 2004, 2:51am by st33d »  

I could murder a pint.
gabon

WWW
Re: Get the content of the data folder
« Reply #2 on: Dec 9th, 2004, 1:36am »

yes, it works, and the link is interesting too... thank u so much, chr
 
Pages: 1 

« Previous topic | Next topic »