The best way to sync files with a sqlite db
I'm looking for the best way to sync files in some directories with a sqlite db.
First of all I use a thread that recursively look for files filtered by extension and add they do my db. Next I use QFileSystemWatcher to watch if files change and it's work well.
The problem is that each time I run the app I don't know if the files are changed so I need to run the thread and it take 100% of cpu of one core during the execution (about 1 minute)
So how can I do to improve this algorithm? Thanks
A solution could be to store the checksum of file contents.
When you start the app you can compute the checksum of each file to check if is changed.
You could use QCryptographicHash to create the HASH