We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Getting data folder content
Page Index Toggle Pages: 1
Getting data folder content (Read 360 times)
Getting data folder content
Aug 8th, 2008, 5:17pm
 
I've found in the processing forum many solution to this problem, but none of then worked. The code bellow seemed to solve this problem to many people, but not for me.

Code:
File dir = new File("sketchbook/default/sketch/data");
String foo = dir.list();


Does anyone knows how can I get the content of the data folder  in the sketch folder? Why that solution doesn't work for me?
Re: Getting data folder content
Reply #1 - Aug 11th, 2008, 1:50pm
 
When I run that code, foo always receives null.
How can I see if that is a PATH problem?
Re: Getting data folder content
Reply #2 - Aug 11th, 2008, 3:32pm
 
Code:
File dir = new File("/path/to/a/folder");
String[] list = dir.list();
if (list == null) {
println("Folder does not exist or cannot be accessed.");
} else {
println(list);
}
Page Index Toggle Pages: 1