Start 2025 on time and up to date! Seamlessly integrate your calendars into Dropbox with these simple steps! 📆

Forum Discussion

jdm2's avatar
jdm2
Explorer | Level 3
6 years ago
Solved

Determine if file has finished synchronising

I have a simple problem:  I store some data in DropBox which is shared between multiple people Several times people have started editing the data bnefore it has finished synchronising What I wa...
  • Greg-DB's avatar
    Greg-DB
    6 years ago

    Dropbox doesn't offer an API for checking the status of the Dropbox desktop client like this, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. 

    Dropbox does offer an API, but it is for communicating directly with the Dropbox servers, regardless of the state of the local Dropbox desktop client (if any). 

    For this use case though, you could potentially implement some of this using code running on the local machine and talking to the Dropbox API. That is, for any particular file:

    • read the locally available file data and compute its "content hash" as documented here
    • call the Dropbox API /2/files/get_metadata endpoint for that file (or /2/files/list_folder[/continue] to list the contents of a folder) and get the relevant `content_hash` value
    • compare the the local and remote content hash values: if they match, you know you have the same data locally and remote; if they don't match, the data differs.

    There are still race conditions possible with such a process though. E.g., the desktop client could sync down the new version of a file right after you check the content hash of the old one and before you compare it with the remote one, etc.

    By the way, those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible. Those have corresponding native methods for the HTTPS endpoints.