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 › browse through folder
Page Index Toggle Pages: 1
browse through folder (Read 1059 times)
browse through folder
Jun 12th, 2005, 12:47pm
 
is there a way to browse and read through folder and file? I didn't find any function to do this.
thank you
Re: browse through folder
Reply #1 - Jun 13th, 2005, 12:34pm
 
The java.io.file class has the features, but I couldn't get anything to work:
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html
Re: browse through folder
Reply #2 - Jun 13th, 2005, 3:20pm
 
java.io.File is the way to go. a simple example to list a directory:

Code:

// the current folder is . but use whatever path you want.
// paths can be a full, specific path like /Users/blah/Desktop
// on mac os x, or "C:\\blah\\somefolder" on windows
File folder = new File(".");
String files[] = folder.list();
for (int i = 0; i < files.length; i++) {
if (files[i].startsWith(".")) { // skip hidden files, plus fake folders . and ..
continue;
}
println(i + " " + files[i]);
}
Re: browse through folder
Reply #3 - Jun 13th, 2005, 4:17pm
 
Super! thank you!
fabio
Page Index Toggle Pages: 1