Question

I currently have a filesystem path I would like to index into a SQL database. I need to access the data so that I can do queries against files based on modified times, or partial names, or many other items.

Is there a way to somehow sync a filesystem to a database automatically, or even access a filesystem in a sql-like interface, without having to crawl through folders recursively?

I was checking the Microsoft Sync Framework 2.0, since it supports SQL databases now, however it doesn't appear to support syncing files to databases.

I'm sure other vendors do something similar, such as Microsoft for the database of files in Media Center, or programs like TVersity storing a database of the files as well.

Was it helpful?

Solution

You don't mention a programming language but here is how I would do it and I think it's the way most media apps maintaining a library do it (although they might be writter in different languages and use the win32 api).

Using .net to get your initial data I would once recursively scan the directory and then add all information to the database. Then I would run a service using a FileSystemWatcher object to be notified about changes and process the events accordingly.

OTHER TIPS

It sounds like what you want is Windows Search. (or the Windows 7 Library feature if you're feeling bleeding edge).

Ultimately though something has to crawl the disk to pull the info out, whether it's you or a third party service.

As an aside SQL may not be the best tool for that particular job, depending on exactly what you want to search for. Tree structures are notoriously tricky to represent in relational databases efficiently - your searches could get quite expensive!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top