|
Author |
Topic: Files and Folders (Read 346 times) |
|
julie@egenius.com
|
Files and Folders
« on: Oct 4th, 2004, 8:59pm » |
|
Is there any facility in Processing to loop through a folder and pick up each file in it - I have bunch of images I would like to display one after the other (like a timed slideshow) One Idea I had was to put the file names in an array and just loop through - but i was look for a more "dynamic" solution. Any help appreciated. Julie.
|
|
|
|
cello
|
Re: Files and Folders
« Reply #1 on: Oct 4th, 2004, 11:19pm » |
|
You could write a simple PHP script to get a listing of all the files in a directory, then pass that as a parameter to the applet. Because applets do not have direct access to the server's filesystem, there is no direct way of getting a list of files in a particular folder on the server. (Unless you used an apache directory listing, download the html, parse it, and pull out the filenames. But that's a bit overkill.) Marcello
|
|
|
|
fjen
|
Re: Files and Folders
« Reply #2 on: Oct 5th, 2004, 4:56pm » |
|
depends if you are planning to have it run as applet or locally. as marcello pointed out, as applet you neither can read the filesystem on the server nor the system on the user side because of security restrictions to applets (sandbox). running locally there still might be some limitations (user settings) but in general you should be able to read some folders & files. works like this: Code: // the directory from within you are running your sketch File folder = new File(System.getProperty("user.dir")); println(folder.getAbsolutePath()); File[] filelist = folder.listFiles(); for (int i=0; i<filelist.length; i++) println(filelist[i].getName()); |
| see: http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html /F
|
« Last Edit: Oct 5th, 2004, 4:57pm by fjen » |
|
|
|
|
|