cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Not happy with your Spotify Wrapped? Check out how Kevin on the Dropbox team used Paper to make sure he keeps discovering new music over 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: 
1
Ask
2
Reply and help

Read folder and download files from URL others users

Read folder and download files from URL others users

Neon20
Explorer | Level 4

Someone gives me a public URL that is a folder with images. How i can read the folder and download the files that contains?

 

URL example: https://www.dropbox.com/sh/iccq7cc0xtvue9t/AADXnwDSYERNKOR6VdeqFmB6a?dl=0

 

Its not mine but i want download the content.

 

Thanks

6 Replies 6

Re: Read folder and download files from URL others users

Gonzo345
Helpful | Level 5

I can't try it here and now, but I would perform a GetMetadata, list all links for all the files and then perform a usual download changing the last character (the =0 by =1, so it forces the download).

 

I don't know if that replies to your question...

Re: Read folder and download files from URL others users

Neon20
Explorer | Level 4
Can expose a example, please.

Re: Read folder and download files from URL others users

Gonzo345
Helpful | Level 5

By now I could just get the "whole" folder name. Let's see if Greg or another Dropboxer replies, but I did it this way:

 

//We obtain the filename on Dropbox to save it later
var taskDescargar = Task.Run(async () => await dropbox.Sharing.GetSharedLinkMetadataAsync(link));
var result = taskDescargar.Result;
string nombreArchivo = result.Name;
carpetaLocal = carpetaLocal + @"\" + nombreArchivo;    //We assign the name

using (var wclient = new WebClient())
{
       wclient.DownloadFile(rutaOrigenOk, carpetaLocal);
}

I'm actually getting the "FOTOS PANORAMA DESDE EL PUENTE.zip" file, which is basically the compressed folder.

 

P.S: done on C# .NET

Re: Read folder and download files from URL others users

Neon20
Explorer | Level 4
Can put the example in Java please? I can't find GetSharedLinkMetadataAsync.... thanks

Re: Read folder and download files from URL others users

Gonzo345
Helpful | Level 5

I'm not really sure about Java, but looks like it could be FileMetadata or FolderMetadata

 

EDIT: Looks more like it's FileLinkMetadata (Sharing.FileLinkMetadata)

Re: Read folder and download files from URL others users

Greg-DB
Dropboxer

If you just need to download the entire folder from a link like this, the simplest way is to use the URL parameters as instructed here:

 

https://www.dropbox.com/help/201

 

If you want to download individual files from the linked folder, you can use the API's /2/sharing/get_shared_link_file endpoint:

 

https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file

 

In the Java SDK, that's the getSharedLinkFile method:

 

https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/sharing/DbxUserSharin...

 

That does require you to know the path of the file that you want in the folder though, and API v2 unfortunately doesn't offer a way to get the file listing.

Who's talking

Top contributors to this post

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