chore(mon_dir): refactored

This commit is contained in:
dancingCycle 2021-11-30 15:01:16 -05:00
parent 62fc139a67
commit bea46175be
1 changed files with 3 additions and 2 deletions

View File

@ -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();