how to detect changes to a folder in asp.net
I have a folder lets call it ComponentsFolder, it has already some components inside it. If some one inserts a new component, when i start the 开发者_如何学运维application it should recognize that a new component has been added and it should extract its path and file size and add to the database (sql server 2005). How can i accomplish this ?
I'm using C# in vs2008.
Take a look at the file watcher class which can detect changes to a file or directory:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx
Use a Windows Service to monitor the folder non-stop:
http://msdn.microsoft.com/en-us/library/aa984074%28v=vs.71%29.aspx
精彩评论