function Start()


This FsWatcher method triggers the asynchronous execution of the underlying file-system watcher, so that your script can subsequently poll it for pending events. No notification will be available to the script prior to calling this method.


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.Start(); // from this point on, notification will be available 
  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;
}