Friday, 15 May 2015

java - Watch a folder structure for changes and process files accordingly -



java - Watch a folder structure for changes and process files accordingly -

i facing next situation ... somewhere in filesystem () accepting files 3rd party application. illustration in folder c:\temp

these files contain specific metadata , have next actions:

a) rellocate according metadata (so first parse them) in 2-level construction such as: c:\temp\idxxx\idyyyy\filezzz each idyyyy folder can contain multiple files each idxxx folder can contain multiple folders (e.g. idyyyy, idyyyye etc.) in root folder there multiple idxxxx type of folders

b) after reallocating these files should monitor each 1st level directory (idxxxx) changes time interval

c) if no changes found (no additional folders/files created) should zip , send somewhere!

d) implement such service run continiously in background ... polling root dir

i trying find library in java manage whole business scenario!

any ideas?

use watchservice monitor directories:

watchservice watchservice = filesystems.getdefault().newwatchservice(); watchkey watchkey = path.register(watchservice, entry_create, entry_delete, entry_modify);

the rest implementing logic using usual file methods.

java file java-ee

No comments:

Post a Comment