1

I need to watch a folder in our network and if any files get dropped in any time of the day I need to ftp to a different folder.

Is this a feasible approach? Are there some links that will take me in right direction?

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124

4 Answers4

3

Use System.IO.FileSystemWatcher to watch the folder: Listens to the file system change notifications and raises events when a directory, or file in a directory, changes.

Use System.Net.FtpWebRequest to send the file through FTP.

Alfred Myers
  • 6,276
  • 1
  • 38
  • 67
1

The best bet might be the filewatcher component. It seems to work reasonable well over a network.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Rob
  • 1,345
  • 1
  • 8
  • 14
1

To watch the file system, the (aptly named) FileSystemWatcher is a useful option. There are many reports of unreliability however, so polling periodically is important.

See this question for a small "Polling vs FileSystemWatcher" debate.

As far as the FTP upload goes, as Alfred says, FtpWebRequest should do what you need.

Community
  • 1
  • 1
Nader Shirazie
  • 10,691
  • 2
  • 35
  • 43
1

FileSystemWatcher as mentioned by the others will work fine in most cases, but not on Novell network drives.

MartW
  • 12,168
  • 3
  • 41
  • 67