We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

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.


  • 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