cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Folder download

Folder download

jjsk
Explorer | Level 4

Per  https://www.dropbox.com/help/desktop-web/download-entire-folders  I can download any folder through the dropbox web interface.  How can I do this via the API? 

 

I'm guessing the web client uses some form of API for this so this should be doable from scripts as well?

 

Thanks

9 Replies 9

Re: Folder download

Greg-DB
Dropboxer
The Dropbox API doesn't offer the ability to download entire folders like this, but I'll be sure to pass this along as a feature request. (The Dropbox web site uses a different, internal interface for this.)

Re: Folder download

jjsk
Explorer | Level 4

I think this would be nice resource saving feature.  I've seen all kinds of recursive download scripts that basically inundate the dropbox API with requests for each individual file.  Seems rather inefficient.   Thanks.

Re: Folder download

deFreitas
New member | Level 2

Here is a workaround, you can create a sharedlink for that folder

 

curl -X POST https://api.dropboxapi.com/2/sharing/share_folder \
--header "Authorization: Bearer $TK" \
--header "Content-Type: application/json" \
--data '{"path": "/legacy/teste-curl","acl_update_policy": "editors","force_async": true,"member_policy": "anyone"}'

 

then download it using the preview_url

 

 

wget -v https://www.dropbox.com/sh/{shared_link_id}?dl=1

 

 

Like this example

 

 

wget -v https://www.dropbox.com/sh/j1msw4e8dup2c5q/AAANYUWXcyBDgxVGkveU7AFla?dl=1

 

 

After all you can unshare this folder for security reasons

 

 

curl -X POST https://api.dropboxapi.com/2/sharing/unshare_folder \
--header "Authorization: Bearer $TK" \
--header "Content-Type: application/json" \
--data "{\"shared_folder_id\": \"1896934208\",\"leave_a_copy\": false}"

 

Re: Folder download

jjsk
Explorer | Level 4


This is nice thanks. I was also trying to decipher the download call through web client but it got a bit hairy.   The zip file comes from 

https://dl-web.dropbox.com/zip_batch?_subject_uid=<dropbox id>

  but I could not figure out in developers tools panel what all the POST parameters were.

Re: Folder download

Greg-DB
Dropboxer
The zip_batch endpoint isn't part of the public API, so I can't offer information on it or recommend trying to use it, as it is subject to change without warning.

Re: Folder download

Greg-DB
Dropboxer
The Dropbox API now offers the ability to download folders as zips:

https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip

If you're using an official SDK, there will also be a corresponding method for this endpoint.

Re: Folder download

jjsk
Explorer | Level 4

Hi Greg

 

This is good news. thanks for the update to the API.

Re: Folder download

jjsk
Explorer | Level 4

I just tried this API call and it worked great.

 

the only hiccup is an error when trying to d/l the root folder

 

"Dropbox-API-Arg": path: The root folder is unsupported

 

some files are saved in the application's root folder and the method seems to fail to get them zipped up

 

Re: Folder download

Greg-DB
Dropboxer

That's the expected behavior. Downloading the root folder is not supported unfortunately, but I'll pass this along as a feature request. 

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    jjsk Explorer | Level 4
What do Dropbox user levels mean?
Need more support?