1
我試圖在Dropbox上使用DbxClientV2實現「跟上對文件和文件夾的更改」。我能夠構建以下內容: TreeMap children = new TreeMap(); Files.ListFolderResult結果;從Dropbox 2.0 API使用Files.listFolder跟上文件夾中文件的更改
String cursor = null;
while (true) {
result = client.files.listFolder("/MyDirectory/Reports");
if (!result.cursor.equals(cursor)) {
cursor = result.cursor;
for (Metadata md : result.entries) {
if (md instanceof DeletedMetadata) {
children.remove(md.pathLower);
} else {
children.put(md.pathLower, md);
}
}
}
if (!result.hasMore) {
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
}
}
}
我的問題是:我怎麼能retrive「/ mydirectory中/報表」文件夾中的光標從Dropbox的服務器檢查自己是否應該更新我的本地庫「孩子」?
它完美的作品!感謝您的回覆! – michal