iOS DropboxSDK,获取远程子目录和内容
我在 Dropbox 上有一个远程目录,其中包含多个子目录和文件。
远程端:
-Mobile Profiles *(root)*
-- Custom Profiles
--- Profile1
--- Profile2
--- Profile3
上传文件和目录/以及带有文件的子目录不是问题。当涉及到将子目录及其内容从保管箱传输到设备时,我简直犯了大错。
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)];
}
}
get
-(void)restoreCustomProfiles {
for ( ) {
/* ? */
}
}
我不知道如何迭代远程端的子目录。
I have a remote directory with several subdirectories and files in them on Dropbox.
remote side:
-Mobile Profiles *(root)*
-- Custom Profiles
--- Profile1
--- Profile2
--- Profile3
Uploading the files and directories / and subdirectories with files is not a problem. I am having 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)];
}
}
get
-(void)restoreCustomProfiles {
for ( ) {
/* ? */
}
}
I am not sure how to iterate through the subdirectories on the remote side.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先加载目录元数据,然后加载它引用的文件。
要限制并行提取的数量,请对所有 loadMetadata 和 loadFile 调用使用 NSOperationQueue 来限制并行提取的数量。为了避免冗余文件下载,请记住 plist 中下载的元数据。
First load the directory metadata, then load the files that it references.
To limit the number of parallel fetches, use a NSOperationQueue for all of the loadMetadata and loadFile calls to limit the number of parallel fetches. And to avoid redundant file downloads, remember the downloaded metadata in a plist.