Monday, March 19, 2012

Newbie needing help -> poll a folder for new files

I need to create a SQLNS app to poll a particular folder for mpeg files. When a new file (which in this case will be an mpeg video file) is dopped into the folder, I need to write some of the files metadata (filename, size, path) to an existing SQL database on the same server. I'd also like to send out an e-mail notifying that an end-user that a record was added to the database.

The subscription piece (e-mail notification) seems easy enough. I'm curious about the implementation of inserting the file metadata into the database. I'm pretty new to SQLNS, so any help to point me in the right direction would be most appreciated.

Thanks in advance!

Hi -

If it were me, I'd probably investigate the following design. I'd create a Windows Service to watch the selected folder for the presence of new mpeg files. When one is discovered, I'd insert a row with the file's metadata into the SQL Server table.

Now for the SQLNS part. I'd create an instance/application that uses the SQL Server Event Provider to watch the SQL Server table mentioned above for the presence of a new row. Subscribers could create subscriptions based on whatever criteria you'd like to put in place (filesize, name, genre, etc).

Make sense?

Could all this be done within SQLNS? Sure, you could create a custom event provider to watch the folder, insert the metadata row, and then insert the event data.

Either would work....but for some reason I tend to prefer the separation afforded by the first solution.

HTH...

Joe

|||Sounds like a great idea! Thanks for your help!! :-D

No comments:

Post a Comment