I'm attempting to write a directory monitor in java but I'm stuck. I'm trying to find something in Java that is like FileSystemWatcher in .NET but I don't think java does. From what I read is that you have to continually poll the directory for changes. What I would like to know is that are there any events and/or signals raised when a changes are made so that one could catch and process them? If not, could someone explain how to simply poll the directory for changes?

Recommended Answers

All 2 Replies

never really thought of that ...
what you could do is create a log file with all the data about the dir you'd like to check, and have a thread continously compare the current state with the state in the log file, but I have no doubt there are for better, easier and more efficient ways to do so.

No event gets generated when directory is changed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.