cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and 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: 

Listing subfolders with Java api v2

Listing subfolders with Java api v2

SparkyNZ
Helpful | Level 5

I am using code such as the snippet below to retrieve file details from Dropbox. How can I tell which entries are folders?

 

I thought there would have been a member in FileMetadata but I am just not seeing it.

 

ListFolderResult result = mDbxClient.files().listFolder("" );

while( true )
{
for( Metadata metadata : result.getEntries() )
{
String sName = metadata.getPathLower();
FileMetadata fileMetadata = (FileMetadata) metadata;

 

1 Reply 1

SparkyNZ
Helpful | Level 5

OK, I found the answer here:

 

https://www.dropboxforum.com/t5/API-support/Get-the-modified-date-for-a-folder-or-file/td-p/184485

 

The short answer is that I need to test metadata with instanceof to see if it is an instance of FolderMetaData or FileMetaData. Java isn't my primary programming language so that was the last thing I would have thought of doing.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    SparkyNZ Helpful | Level 5
What do Dropbox user levels mean?