cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more 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: 

Download entire folder from Dropbox using Vb. NET

Download entire folder from Dropbox using Vb. NET

LuGas
New member | Level 2

Hi guys!
I'm trying to write code to create a program that will download and upload files and folders from/to Dropbox automatically.

When I need to download a single file there's no problem using X.files.downloadAsync("path", await X.GetContentAsByteArrayAsync), but when I need to download an entire folder I don't know how to do it, I can't use the same instruction...

Someone know how to solve this issue?

4 Replies 4

Greg-DB
Dropbox Staff

If you want to download an entire folder using the .NET SDK, you have two options:

  1. Use the DownloadAsync method, calling once per file inside the folder. You can use the ListFolderAsync and ListFolderContinueAsync methods to get the file listing.
  2. Use the DownloadZipAsync method to download the entire folder, as long as its contents are under the documented size and file count limits. With this method, you'd then need to unzip the resulting data to access the contents. The Dropbox SDK itself doesn't offer an unzipping method, so you may need a system method or a different library to do that.

erich_e
New member | Level 2

Silly question (RE: Option 2 "Use the DownloadZipAsync method to download the entire folder...").  To where does DownloadZipAsync(...) download the zip file??

 

The DownloadFileAsync() method accepts an argument containing the download target folder, but I see no such option in for the argument to DownloadZipAsync(...).

Здравко
Legendary | Level 20

Hi @erich_e,

In both cases (downloading a regular file of any kind or a folder as a zip) there is stream that may be use as you would like. Of course you may redirect/copy this stream to another file stream that refers to file named as you like. Is there something that prevent you do so?

Good luck.

Greg-DB
Dropbox Staff

@erich_e As Здравко said, you can get the requested data (either individual file or zip of a folder) using the returned stream (or string, or byte array). Specifically, check out the documentation for DownloadZipAsync and for the IDownloadResponse Interface in particular for the three methods of accessing the data. There's also an example of using one of them here.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    erich_e New member | Level 2
What do Dropbox user levels mean?