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,738
  • 21
  • 105
  • 131

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,384
  • 1
  • 40
  • 68
1

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rob
  • 1,320
  • 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,736
  • 2
  • 37
  • 43
1

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

MartW
  • 12,348
  • 3
  • 44
  • 68