1. // infinite loop helps monitoring the root directory continously for changes
  2. while (true) {
  3. // Creating a list of all files in the current watch from root-dir and sub-dirs
  4. // Comparing with the list of files in previous watch
  5. if(file exists in current watch and also in previous watch){
  6. if(fileInCurrentWatch.modifiedDate() > fileInPreviousWatch.modifiedDate()){
  7. System.out.println("FILE MODIFIED : " + file);
  8. }
  9. }
  10. if(file exists in current watch but not in previous watch){
  11. System.out.println("FILE ADDED : " + file);
  12. }
  13. if(file exists in previous watch but not in current watch){
  14. System.out.println("FILE DELETED : " + file);
  15. }
  16. //Condition for file being renamed????????
  17. }