I would like to monitor for new files or whether files has changed in directory. I know I could just make it all from the button, but does anyone know or could recommend a good framework that does the job. Maybe a framework where you can add an observer to get notifications about which file has changed?
Kind regards Torben Riis
posted 9 years ago
This has been asked often enough that you might find something out there. Spend some time with Google and let us know what you find.
If you decide to write something you have a couple choices. One is to write a C/C++ module that uses operating system APIs and wire that up to your Java program with JNI. It's not portable, but could be pretty cool. Another is to read the list of current files into some structure, then do it again every few minutes and compare lists to find new things. Or just comparing timestamps to the last time you ran might meet your requirements. Or not.
To list all files in a folder and all subfolders, the new DZone Snippets site has a cute File Iterator. You'll have to search around for his FlatteningIterator, too.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi