简体   繁体   中英

How do I campare contents of local folder on android sdcard with the contents of a folder on dropbox?

I am developing a android app and I am supposed to download some data to a folder on sdcard from dropbox folder and once the download is complete only then the app can start. The problem is I have some files available on my sdcard folder which are also present on dropbox folder along with some other files ,and now when I start my app I should be able to download only those files which are not there on my sdcard folder. How should I go by it? Thanks.

When you download any files from Dropbox, store the rev value from the Dropbox file's metadata.

Later, when you check again, if the remote rev matches your local value, you know you still have the same version. If not, download the new version.

Just checking the filename and file size is error prone, since two different versions of a file can have the same size.


Edit: The Dropbox API now offers a hash of file data that you can use to verify a file's contents. In the API v2 Java SDK, it's available as FileMetadata.contentHash .

It isn't a single MD5 or SHA1, but rather a combination of SHA256 hashes of the pieces of the file. You can find more information here:

https://www.dropbox.com/developers/reference/content-hash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM