Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Wei O.
10 years agoNew member | Level 2
How to download files in a shared folder url with python api?
Hi I am trying to develop some script to download files shared by others, the shared url is linked to a folder, so how can download all the files in the folder.
I tried dbx.sharing_get_shared_link_file, but it's complaining that the it's a folder link.
And then I tried dbx.sharing_get_shared_link_metadata, I can only get the metadata, without even know what's inside the folder link.
Is there a way to list all the files and subfolders in the folder url and download them?
Thank you.
4 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
Unfortunately, API v2 doesn't currently offer the ability to list out the contents of a shared link for a folder, but I'll be sure to pass this along as a feature request.
- Wei O.10 years agoNew member | Level 2
But how about v1? Is there a way to access with v1 in python? Thank you.
- Greg-DB10 years ago
Dropbox Community Moderator
The v1 /metadata/link endpoint does return the contents for a shared link for a folder:
https://www.dropbox.com/developers-v1/core/docs#metadata-link
This isn't implemented in the Python SDK, but you can call the endpoint directly.
- Greg-DB9 years ago
Dropbox Community Moderator
Dropbox API v2 now supports listing the contents of a shared link for a folder. This can be accomplished using the same interface as listing a folder in a connected user's account, via the list_folder functionality. To list the contents of a shared link for a folder, you instead provide the shared link URL in the `shared_link` parameter to list_folder:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
If you're using an official SDK, there will also be a corresponding method for this endpoint:
In the .NET SDK that's available as `ListFolderAsync`:
https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesUserRoutes_ListFolderAsync_1.htm
In the Java SDK that's available via `listFolderBuilder` to get a `ListFolderBuilder` on which you can call `ListFolderBuilder.withSharedLink`:
https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesRequests.html#listFolderBuilder-java.lang.String-
https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/ListFolderBuilder.html
https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/ListFolderBuilder.html#withSharedLink-com.dropbox.core.v2.files.SharedLink-
In the JavaScript SDK that's available as `filesListFolder`:
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolder__anchor
In the Python SDK that's available as `files_list_folder`:
https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_list_folder
In the Swift SDK that's available as `listFolder`:
https://dropbox.github.io/SwiftyDropbox/api-docs/latest/Classes/FilesRoutes.html#/s:13SwiftyDropbox11FilesRoutesC10listFolderAA10RpcRequestCyAA0C0C04ListF16ResultSerializerCAH0if5ErrorK0CGSS4path_Sb9recursiveSb16includeMediaInfoSb0O7DeletedSb0O24HasExplicitSharedMembersSb0O14MountedFolderss6UInt32VSg5limittF
In the Objective-C SDK that's available as `listFolder`:
https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBFILESUserAuthRoutes.html#/c:objc(cs)DBFILESUserAuthRoutes(im)listFolder:
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!