Forum Discussion

rschuber's avatar
rschuber
Explorer | Level 3
2 years ago

how to trigger a folder sync programmatically?

I have a Daemon on my local device (mac) that processes some files and writes the output to a dropbox folder. It successfully runs and writes the data to dropbox, but the dropbox folder does not synchronize until a user is signed into the device. I want the dropbox folder to synchronize even when a user is not specifically signed into the device. Is there a way to trigger this behavior as the root user? I understand that the dropbox api has some ability to manipulate files, I want to know if that is useable route before I dive too deep into it.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    rschuber wrote:

    ..., but the dropbox folder does not synchronize until a user is signed into the device. ...


    Hi rschuber,

    Yes, it's so because official Dropbox application works as a regular application (or user service), not as a system service, 🤦 unfortunately. So the Dropbox application needs running user session (i.e. signed in user). That's it.

     


    rschuber wrote:

    ... Is there a way to trigger this behavior as the root user? ...


    If you mean to trigger user session using system service (running in root context), most probably you can, but such "exercise" is NOT something trivial and it's NOT Dropbox SUPPORTED. You can try on your responsibility.

     


    rschuber wrote:

    I have a Daemon on my local device (mac) that processes some files and writes the output to a dropbox folder. It successfully runs and writes the data to dropbox, ... I understand that the dropbox api has some ability to manipulate files, I want to know if that is useable route before I dive too deep into it.


    Yes, you can use that "route". 😉 Seems, you have implemented you sync algorithm already and since it works properly, you can upload the files direct to their place on Dropbox server instead of copy them to local Dropbox folder. In such a way you don't need running official Dropbox application actually - your application becomes Dropbox application (in the part related to upload). You need to register application on Dropbox site (create new app there) and implement the uploading. Take a look here for more info.

    Good luck.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    rschuber Здравко is correct; Dropbox doesn't officially support a way of programmatically controlling the desktop client like that. You can use the Dropbox API instead though, which communicates directly with the Dropbox servers instead of the local Dropbox client. The Getting Started and File Access guides may be helpful

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with other developers804 PostsLatest Activity: 9 hours ago
217 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!