Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. The best way to sync files with a sqlite db
Forum Updated to NodeBB v4.3 + New Features

The best way to sync files with a sqlite db

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 864 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andrea993.93
    wrote on last edited by
    #1

    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

    Regards A993

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      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

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved