- // infinite loop helps monitoring the root directory continously for changes
- while (true) {
- // Creating a list of all files in the current watch from root-dir and sub-dirs
- // Comparing with the list of files in previous watch
- if(file exists in current watch and also in previous watch){
- if(fileInCurrentWatch.modifiedDate() > fileInPreviousWatch.modifiedDate()){
- System.out.println("FILE MODIFIED : " + file);
- }
- }
- if(file exists in current watch but not in previous watch){
- System.out.println("FILE ADDED : " + file);
- }
- if(file exists in previous watch but not in current watch){
- System.out.println("FILE DELETED : " + file);
- }
- //Condition for file being renamed????????
- }