Ftp file watcher such as SystemFileWatcher in .net?


In my project, I need to constantly look at several FTP folders, if I need any new file, I need to select the file name and execute some process.

If this is a regular Windows / Local File System folder, I can achieve this using SystemFileWatcher .net.

Is there something like SystemFilewatcher to watch FTP folders?


nrk

+4
source share
2 answers

No, this does not exist, because the FTP folder cannot send you any events about any changes. So you need to write your own little class with a background worker. This question periodically asks the ftp server for a directory listing and compares it to the last list received. Then you can trigger some events depending on the changes that have occurred.

So, you will get an event class in .Net, but under the hood will pull a model with a lot of traffic on the wire.

+7
source

I do not understand @Oliver answer. Of course, there is a way to use the FileSystemWatcher class to view events in an FTP folder, and this is not a pull model. I am working on creating something similar right now using the model described in this MSDN article:

Windows Services: New Base Classes in .NET Make Recording Windows Services Simple

To use FSW effectively, you create it in a Windows service and monitor FTP folders. Of course, you will need to install it on an FTP server (not somewhere on the network), but it will do exactly what you need.

0
source

Source: https://habr.com/ru/post/1300705/


All Articles