This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I need a very simple process that listens on a directory.When a new file is created on that directory,
the new file has to be copied to a remote location.
I have created the listener but how can I check for new file from the set of files in directory using java code. There is no creationdate method in java file api.There is only one lastmodifed() method for the java file metadata operations.
Assuming you use a Timer you can have a task the wakes up every n seconds and lists the contents of the directory. It could check this against some persistent list of file names stored when it last ran and copy any files not previously listed.