IOS DropboxSDK, get deleted subdirectories and contents

I have a remote directory with several subdirectories and files in them in Dropbox.

remote side:

-Mobile Profiles *(root)*
-- Custom Profiles
--- Profile1
--- Profile2
--- Profile3

Uploading files and directories / and subdirectories to files is not a problem. I have a brain fart when it comes to getting the subdirectories and their contents from Dropbox to the device.

put

-(void)backupCustomProfiles {
    for ( NSString *file in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MP_CUSTOM error:&error] ) {
        [self.restClient uploadFile:file toPath:@"/Mobile Profiles/Custom Profiles/" fromPath:EasyStrings(MP_CUSTOM,file)];
    }
}

receive

-(void)restoreCustomProfiles {
    for ( ) {
        /* ? */
    }
}

I am not sure how to go through subdirectories on the remote side.

+1
source share
1 answer

First download the directory metadata, then download the files that it refers to.

, NSOperationQueue loadMetadata loadFile, . , plist.

- (void) restoreCustomProfiles
{
    [self.client loadMetadata:@"/Mobile Profiles/Custom Profiles" withHash:hash];
}

- (void) restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata
{
    for (DBMetadata* child in metadata.contents) {
        NSString *path = [child.path lowercaseString];

        if (child.isDirectory) {
            [client loadMetadata:child.path withHash:hash];
        } else {
            [client loadFile:pathToDownload intoPath:[
                                self.directory stringByAppendingString:path]];
        }
    }
}

- (void) restClient:(DBRestClient*)client loadedFile:(NSString*)destPath
{
    // successfully downloaded a file to destPath
}
+5

All Articles