I need a java program that on demands returns a list of newly added files to a directory. My definition of new file is the one which was not there at last checkup/scanning of the directory.
I know there are libraries such as JNotify, and java directory watch service http://docs.oracle.com/javase/tutorial/essential/io/notification.html. However in my understanding these libraries implement listeners that watch a directory and notify as soon as some file event (add, remove, delete, etc) occurs. But what I need is a method which on demand returns a list of newly added files to a directory.