Checking the contents of a folder on demand
in
Programming Questions
•
1 year ago
Hi everybody, I am working on a project which relies on my sketch checking how many files there are in a folder on demand, perhaps in a regular interval, 1000ms?
I have some code which allows me to find out how many files are in a particular folder, but i'm still a little new to processing and I don't understand how to trigger this. If one of you could point me in the right direction, I would be grateful.
Also, while i'm asking, is there a way to create a relative search path in Processing?
Thanks,
eplus.
- String path = "/Users/Eplus/Dropbox/Dropbox/Apps/iStopMotion/Exports";
- String[] filenames = listFileNames(path);
- String[] listFileNames(String dir) {
- File file = new File(dir);
- if (file.isDirectory()) {
- String names[] = file.list();
- println(names);
- return names;
- } else {
- // If it's not a directory
- return null;
- }
- }
1