You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
James_T
4 years agoHelpful | Level 6
Quickest way to check if a folder and subfolders are empty?
I only want the Dropbox Embedder to show if the specified folder actually have any files in it. What is the best way to figure out if a folder (or subfolder) has any files? At first I thought a...
Greg-DB
Dropbox Staff
While it may require more than one API call, using the /2/files/list_folder[/continue] endpoints (or corresponding native methods in the SDKs) is the best way to check if a particular folder is empty or not. The exact number of entries per page and total number of pages is not guaranteed and may vary by folder/account, so you would need to call back to /continue until 'has_more' is returned as false. I'll also pass this along as a feature request for a simpler way to check that, but I can't promise if or when that might be implemented.
James_T
4 years agoHelpful | Level 6
Thanks for your reply.
The folder I tested list_folder with, contains only 4 directories. The API call only returned 1 folder (+ the root folder). Is that normal behavior?
It thought it would only require the continue call if there were lots of folder/files?
- Greg-DB4 years agoDropbox Staff
The number of entries you get back per page is not guaranteed, and it may require multiples calls even if there is not a large number of entries. You'll need to implement both list_folder and list_folder/continue and always call back for more entries until has_more is false in order to get the full listing.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf 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 or Facebook.
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!