One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
littleninja
8 years agoExplorer | Level 3
Creating a syncing folder in the Dropbox Desktop folder with Node JS
I'm developing a desktop (electron) app that integrates with the Dropbox javascript SDK and uses node js to perform tasks on the local machine, allowing an online and offline experience.
All I am doing is programmatically creating a new folder in the Dropbox desktop folder using node js... the problem is that it automatically sets to NOT sync. I need it to sync as default. If I manually create a new folder then it DOES automatically set to sync.
I have copied the extended attributes found on the syncing folders but it still will not set to sync:
So I created 'General Information' through Node js and 'Hello' was created manually. You can see the different symbols.
This is the what I see when I look at the folders permission and extended attributes via the Terminal... they are identical (after creating the folder with Node js I then get the extended attributes of the syncing parent folder and apply these attributes to the newly created folder).
Can anyone help here? I really need to be able to do this for the app to work as it needs to! I guess I just need to know the exact requirements for creating the folder in the first place that would enable it to sync as default like the manually created one - I honestly didn't foresee this being an issue and it's holding me up badly!
I've been in touch with Dropbox Help who were, well, not much help at all!
- Greg-DB
Dropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/47094600/creating-a-syncing-folder-in-the-dropbox-desktop-folder-with-node-js ]
If you use the JavaScript SDK to create a new folder, that contacts the Dropbox API servers to issue the create folder command. The Dropbox servers then sends down information about the new folder to the desktop client.
If you create the folder manually, you're creating it first on the local filesystem, and then the desktop client syncs that up to the Dropbox servers.
That difference is creating the discrepancy you're seeing in these two cases with respect to the online only status for these two folders.
The Dropbox API doesn't offer an interface for managing online only settings, but I'll pass this along as a feature request. (We also don't officially support/document managing things like this via the extended attributes. Since those aren't documented, they're subject to change, so you shouldn't rely on them.)
You can set the default behavior for online only though, as covered in this help article under "How can I choose a default setting for new content?" (Be sure to expand Mac or Windows first.)
- littleninjaExplorer | Level 3
Thanks for your reply... I see what you're saying but managing the smart sync settings doesn't solve my problem... I guess what I'm trying to do is manually sync a file or folder from dropbox.com to the local dropbox folder by retrieving the folder/file information and then either creating the folder or downloading the file and saving it in the correct location. Creating a folder manually, like the Hello one, is exactly what I need to be able to do programmatically through node js.
Is there an endpoint in the Dropbox API somewhere that requests a manual sync of a folder or file to the local dropbox folder? That would answer all my problems!!
- Greg-DB
Dropbox Staff
No, unfortunately there isn't an API call like that. We'll consider it a feature request, but I can't promise if/when it would be implemented. Sorry I don't have better news for you!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,940 PostsLatest Activity: 2 days ago
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!