tags:

views:

600

answers:

2

Is there a way to monitor folders in java to see when they are updated, ie file created, deleted, renamed,etc. And also is there any way to set it that it only looks for files that begin with a certain prefix, ie img?

+4  A: 

See my answer to a similar question.

The mechanisms detailed won't filter on a file name/type. You'll have to do that alongside the suggested solutions.

Brian Agnew
+3  A: 

In Java 7 there'll be a WatchService API as part of NIO2. For previous/existing Java versions there's no pure Java solution except for manual polling.

Joachim Sauer