public void directoryWatcher(String path){
        try {
            Path p = Paths.get(path);
            WatchService ws = p.getFileSystem().newWatchService();
            p.register(ws, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE);
            while (true){
                WatchKey watchKey = ws.take();
                for (WatchEvent event : watchKey.pollEvents()) {
                    System.out.println(event.kind() + " : " + event.context());
                    watchKey .reset();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }