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.
What do you think is a feasible approach? Please post links if you have any that will take me in right direction.
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.
What do you think is a feasible approach? Please post links if you have any that will take me in right direction.
Best bet might be the filewatcher component. Seems to work reasonable well over the network.
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.
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.
FileSystemWatcher as mentioned by the others will work fine in most cases, but not on Novell network drives.