我正在开发一个应用程序,它将在Dropbox上获取文件的最后修改时间和日期,并且它将获得最后修改日期(文件的上传时间)和文件在本地计算机上的时间,然后在comaparing两个时间之后和日期,应用程序将决定是上传该文件还是从Dropbox下载。现在我坚持这个问题,我怎么能得到最后修改日期& Dropbox上特定文件的时间。
答案 0 :(得分:2)
在Dropbox开发论坛上回答了一秒钟:https://forums.dropbox.com/topic.php?id=109662。
但为了后代而粘贴在这里:
它是文件元数据的一部分:https://www.dropbox.com/developers/core/docs#metadata
答案 1 :(得分:0)
private void GetServerModifiedTime(String my_token, String my_path_to_root_folder) throws IOException
{
//create the new DropBox client
DbxClientV2 my_dropbox_client = new DbxClientV2(new DbxRequestConfig("my_app_name_and_version"), my_token);
List<Metadata> list_of_metadata_for_all_files = new ArrayList<Metadata>();
try {
//get a list of all files
list_of_metadata_for_all_files = my_dropbox_client.files().listFolder(my_path_to_root_folder).getEntries();
for (Metadata file_metadata : list_of_metadata_for_all_files)
{
if (!(file_metadata instanceof FolderMetadata)) {
String file_name = file_metadata.getName();
String root_path_plus_file_name = my_path_to_root_folder + "/" + file_name;
FileMetadata file_meta_data = (FileMetadata) my_dropbox_client.files().getMetadata(root_path_plus_file_name);
Date file_date = file_meta_data.getServerModified();
long file_server_modified = file_date.getTime();
Log.i("", "-------->" + file_server_modified + "\n");
}
}
}catch (DbxException ignore){
throw new IOException(ignore);
}
}