chore(mon_dir): refactored
This commit is contained in:
parent
62fc139a67
commit
bea46175be
|
@ -4,11 +4,12 @@ import java.io.IOException;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
private static final String FOLDER="/opt/npm";
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException,
|
public static void main(String[] args) throws IOException,
|
||||||
InterruptedException {
|
InterruptedException {
|
||||||
|
|
||||||
Path folder = Paths.get("./");
|
Path folder = Paths.get(FOLDER);
|
||||||
|
|
||||||
//obtain WatchService instance using FileSystems class
|
//obtain WatchService instance using FileSystems class
|
||||||
WatchService watchService = FileSystems.getDefault().newWatchService();
|
WatchService watchService = FileSystems.getDefault().newWatchService();
|
||||||
|
@ -35,7 +36,7 @@ public class Main {
|
||||||
String fileName = event.context().toString();
|
String fileName = event.context().toString();
|
||||||
System.out.println("File deleted:" + fileName);
|
System.out.println("File deleted:" + fileName);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Event unkown");
|
System.out.println("Event unknown");
|
||||||
}
|
}
|
||||||
valid = watchKey.reset();
|
valid = watchKey.reset();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue