Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class JNotifyExample
- public static void main(String[] args) throws InterruptedException, IOException
- {
- String dir = new File(args.length == 0 ? "." : args[0]).getCanonicalFile().getAbsolutePath();
- JNotify.addWatch(dir, FILE_ANY, true, new JNotifyListener()
- {
- public void fileRenamed(int wd, String rootPath, String oldName,
- String newName)
- {
- System.out.println("renamed " + rootPath + " : " + oldName + " -> " + newName);
- }
- public void fileModified(int wd, String rootPath, String name)
- {
- System.out.println("modified " + rootPath + " : " + name);
- }
- public void fileDeleted(int wd, String rootPath, String name)
- {
- System.out.println("deleted " + rootPath + " : " + name);
- }
- public void fileCreated(int wd, String rootPath, String name)
- {
- System.out.println("created " + rootPath + " : " + name);
- }
- });
- System.err.println("Monitoring " + dir + ", ctrl+c to stop");
- while (true) Thread.sleep(10000);
- }
- }
Add Comment
Please, Sign In to add comment