We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here. 

Forum Discussion

jdm2's avatar
jdm2
Explorer | Level 3
5 years ago

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 want is a simple routine which I can add to my application which determines whether a named file is synchronised, i.e. it is the same as the cloud version.

If the file isn't synchronised I will simply wait for the automatic synchronisation to complete.

The application is written in C# and is running on Windows 7 and 10

I have looked quite hard but I cannopt find an answer to this, apparently simple, question apart from "look at the DropBox App" which is precisely what my users dont do!

  • 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. 

  • Daphne's avatar
    Daphne
    Icon for Dropbox Staff rankDropbox Staff

    Thanks for reaching out to us here jdm2, I hope you're having a good day!

    The best way I can suggest to determine whether your files are up to date, would indeed be to check the desktop app's sync status by looking at the Dropbox icon.

    The folder members could also check the file itself to see if it's showing the syncing icon :arrows_counterclockwise: before opening the file.

    As a work around, I could suggest moving the file out of the folder while it's being edited and move it back once finished. This removes the file from the shared folder, and acts as a way to let others know the file is being worked on.

    If you happen to be using Microsoft Office files, you can check out the Dropbox Badge lets you know if others are also editing the file.

    I hope this helps to some extent, let me know if you have any other questions - thanks!

    • jdm2's avatar
      jdm2
      Explorer | Level 3

      Unfortunately none of your solutions work better than doing nothing.

      My users don't actually know which files they should worry about. They are real users who are experts in what they use the application for but donb't understand computers at all.

      Moving the files out would make things worse - every change is small and atomic and I would be copying the whole file back every 10 seconds or less. DropBox does a marvelous job of propagating such changes to other users so crashes only affect the session in question. 

      The lack of such functionality seems like a real hole in DropBox. It does everything else I need it to autromatically,

      I just want to be able to observe it. It must be possible since the file explorer in Windows can display the correct badge on each file according to whether it is synchronised or not. 

      • Daphne's avatar
        Daphne
        Icon for Dropbox Staff rankDropbox Staff

        Thanks or getting back to me here jdm2!

        I completely understand that the steps I mentioned aren't ideal for you, the way each person uses Dropbox can vary a great deal.

        The desktop app will sync any changes that are made and available on the web as soon as they're made. This should mean that when the file shows :white_check_mark:, the file is up to date and reflecting the version from the web.

        Since the sync icons aren't ideal for you, can you let me know a little more detail how you would want to observe the versions locally and online?

        If we don't have a way to do this through the app itself other than the sync status, there may be some users here who could make some suggestions based on how you'd like to do this (via command line perhaps or API).

        Keep me posted!

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

795 PostsLatest Activity: 5 days ago
192 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!