How to poll a directory to check if a new file has been added?

I want to poll the directory to see if a new file has been added to the directory. If a new file is added, I want to read this file.

Can someone give me an idea how to do this?

+9
source share
4 answers
+16
source

If you use Java 7, you can use the file system monitoring service (a new feature in Java 7).

See the Oracle manual for instructions on how to use it.

( Java) , Apache Commons IO. org.apache.commons.io.monitor - .

+6

Apache Camel?

:

from("file://pollingfolder?delete=true").to("bean:handleOrder");

" ", bean- handleOrder. !

Spring-boot , Spring, Java.

: Apache Camel

+1

All Articles