The Dropbox API shows some sample code for listing the files in a given folder:
List files in a folder You can list the files in folder you just uploaded to with the following call:
[[self restClient] loadMetadata:@"/"];
The rest client will call your delegate with one of the following callbacks:
- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata {
if (metadata.isDirectory) {
NSLog(@"Folder '%@' contains:", metadata.path);
for (DBMetadata *file in metadata.contents) {
NSLog(@"\t%@", file.filename);
}
}
}
- (void)restClient:(DBRestClient *)client
loadMetadataFailedWithError:(NSError *)error {
NSLog(@"Error loading metadata: %@", error);
}
Metadata objects are how you get information on files and folders in a user's Dropbox. Calling loadMetadata: on / will load the metadata for the root folder, and since it's a folder the contents property will contain a list of files and folders contained in that folder. It's advisable to keep this data around so that the next time you want to do something with a file, you can compare its current metadata to what you have stored to discern whether the file has been changed. Check out DBMetadata.h to see all the information metadata objects have.