FileSystemWatcher for FTP

softwarematter picture softwarematter · Aug 14, 2009 · Viewed 21.4k times · Source

How can I implement a FileSystemWatcher for an FTP location (in C#). The idea is whenever anything gets added in the FTP location I wish to copy it to my local machine. Any ideas will be helpful.

This is a follow up of my previous question Selective FTP download using .NET.

Answer

Lasse V. Karlsen picture Lasse V. Karlsen · Aug 14, 2009

You're going to have to implement a polling solution, where you keep asking for the directory content periodically. Compare this to a cached list from the previous call and determine what happened that way.

There's nothing in the FTP protocol that will help you with this unfortunately.