CREATE、MODIFY、および DELETE イベントをモニターに正常に登録しましたが、問題なく動作します。私の問題では、CREATEイベントがトリガーされたら「名前の変更」などのファイル変更を行いたいので、次にMODIFYイベントもトリガーされますが、それは望ましくありません。今回はMODIFYイベントを省略してもいいですか?
if(event.kind().equals(StandardWatchEventKinds.ENTRY_CREATE)){
try{
if(!name.toString().startsWith("~")){
Path tempPath = Paths.get(path+"/~temp_"+name.getFileName());
Path oldPath = Paths.get(path+"/"+name.getFileName());
Files.move(oldPath, tempPath, StandardCopyOption.REPLACE_EXISTING);
PDFStamp.stampPDF(tempPath.toString(), oldPath.toString());
omitPath.put(name, name);
Files.delete(tempPath);
}
}catch(Exception e){
e.printStackTrace();
}
}