Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
StevenWhitey
10 years agoNew member | Level 2
Accessing .tag or just listing folders Swift
I have looked everywhere and can't seem to find an answer. I am trying to list just folders in a table. When I do a listFolder call it gives me all the folders and files with a .tag. Is there any way to access that .tag or just list the folders? I know you can list files by using the Suffix but what about folders? Thanks for your help. Below is what I get back with my listFolder call.
cursor = "AAHIpnuEeMPvYAsZGaogNyLu0QCvyr6T5YnIK_2ZQDfObTzFEIaf4BKSdaJsgIxC82IirZgWfzvN41axn-jKmySsPHoXwGmn-mxsEKHgV_hOUHqIUQxURYlL2AzzbzcZNZvo3AKmlPDRGkLq3Ax6uvMmSN1ZdKg3QHoGIIeno_9Jn-DbrzZG3Qx8un1ekCASy00";
entries = (
{
".tag" = folder;
id = "id:EinVKuuPCRAAAAAAAAAAAw";
name = "Test Folder";
"path_display" = "/Test Folder";
"path_lower" = "/test folder";
},
{
".tag" = folder;
id = "id:EinVKuuPCRAAAAAAAAAAFw";
name = "2nd folder";
"path_display" = "/Test Folder/2nd folder";
"path_lower" = "/test folder/2nd folder";
},
{
".tag" = folder;
id = "id:EinVKuuPCRAAAAAAAAAAHA";
name = "Another Folder";
"path_display" = "/Another Folder";
"path_lower" = "/another folder";
},
{
".tag" = folder;
id = "id:EinVKuuPCRAAAAAAAAAAIA";
name = "Photo Watch";
"path_display" = "/Apps/Photo Watch";
"path_lower" = "/apps/photo watch";
},
{
".tag" = folder;
id = "id:EinVKuuPCRAAAAAAAAAAHw";
name = Apps;
"path_display" = "/Apps";
"path_lower" = "/apps";
},
{
".tag" = file;
"client_modified" = "2016-11-01T22:37:58Z";
id = "id:EinVKuuPCRAAAAAAAAAAAg";
name = "Get Started with Dropbox.pdf";
"path_display" = "/Get Started with Dropbox.pdf";
"path_lower" = "/get started with dropbox.pdf";
rev = 1502f5529;
"server_modified" = "2016-11-01T22:37:58Z";
size = 905827;
},
{
".tag" = file;
"client_modified" = "2016-11-02T03:28:56Z";
id = "id:EinVKuuPCRAAAAAAAAAABA";
name = "8-3-Travel-Photo-3.jpg";
"path_display" = "/Test Folder/8-3-Travel-Photo-3.jpg";
"path_lower" = "/test folder/8-3-travel-photo-3.jpg";
rev = 3502f5529;
"server_modified" = "2016-11-02T03:28:56Z";
size = 109879;
}
You can filter Metadata objects by checking if they are FileMetadata or FolderMetadata (or DeletedMetadata) instances as shown here:
https://github.com/dropbox/SwiftyDropbox#response-handling-edge-cases
3 Replies
- Greg-DB10 years ago
Dropbox Community Moderator
You can filter Metadata objects by checking if they are FileMetadata or FolderMetadata (or DeletedMetadata) instances as shown here:
https://github.com/dropbox/SwiftyDropbox#response-handling-edge-cases
- ravisharma9 years agoNew member | Level 2Can you share your code?
- Greg-DB9 years ago
Dropbox Community Moderator
ravisharma What are you looking for exactly? If you need to see how to distinguish between files and folders, that's in the README:
https://github.com/dropbox/SwiftyDropbox#response-handling-edge-cases
If you're looking for a sample for listing items, there are some examples here:
https://github.com/dropbox/PhotoWatch/blob/48df3b99b47f4a883703f7a4cd9512eb2a5c0cb2/PhotoWatch/ViewController.swift
https://stackoverflow.com/documentation/dropbox-api/412/listing-a-folder/1371/listing-the-root-folder-using-the-swiftydropbox-library-distinguishing-files-an#t=201707281719552275747Those only call listFolder though, so you'll need to make sure you call listFolderContinue too, as described in the second link.
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!