function WatchDir(path, recursive)


This FsWatcher method adds a directory/folder to the list of directories/folders "watched" by the file system watcher.
The path parameter is a string, and specifies a directory to be watched.

The recursive parameter is a boolean, and specifies whether or not the FsWatcher should also watch all sub-folders of the specified folder.


Example:


{
 ConsoleFeedback = true;
 var scli = new SftpClient();
 scli.Host = 'your.sftpserver.com:22';
 scli.User = 'some_username';
 scli.PassFromSecret = 'name_of_the_secret_password';
 if (scli.Connect()) {
  watchr = new FsWatcher();
  watchr.WatchDir('C:\\Docs', true);
  watchr.NotifyRename = false;
  watchr.InclusionFilter = ['*.docx', '*.xlsx']
  watchr.ExclusionFilter = ['some_private_document.docx']
  watchr.Start(); 
  while (true) {
   Sleep(1000);
   if (HaltSignalReceived) {
    break;
   }
   evt = watchr.Events()
   if (evt.length > 0) {
    for (var i = 0; i < evt.length; i++) {
     if (evt[i].Event == 'WRITE') {
      scli.UploadWithPath(evt[i].Object, '/realtimebackup', 0);
     }
    }   
   }
  } 
  scli.Close();   
 } 
 scli = nil;
}