nRk
nRk

Reputation: 1239

Ftp file watcher like SystemFileWatcher in .net?


In my project I need to watch multiple FTP Folders continuosly, if any new file comes i need pick the filename and do some process.

If that is normal Windows/Local File System folder I can achieve this by using SystemFileWatcher of .net.

Is there any thing like SystemFilewatcher to watch FTP folders?


nrk

Upvotes: 5

Views: 4006

Answers (2)

Cyberherbalist
Cyberherbalist

Reputation: 12319

I don't understand @Oliver's answer. Of course there is a way to use the FileSystemWatcher class to watch events in an FTP folder, and it's not a pull model. I'm working on creating something just like it right now, using the model as described in this MSDN article:

Windows Services: New Base Classes in .NET Make Writing a Windows Service Easy

To effectively use the FSW, you build it into a Windows Service, and have it watch the FTP folder(s). Of course, you'd need to install it on the FTP server (not somewhere else in the network), but it would do exactly what you need.

Upvotes: 0

Oliver
Oliver

Reputation: 45109

No this doesn't exist, because a FTP folder can't send you any events about any change. So you have to write your own little class with a background worker. This one asks the ftp server for directory listing periodically and compares it against the last list obtained. Then you can fire some events depending on the happen changes.

So you'll get an event class in .Net but under the hood it will be pull model with lot of traffic on the wire.

Upvotes: 7

Related Questions