Compare Device Image Files to Server Image Files

Bill Norris

Active Member
Licensed User
Longtime User
Every few days I have to update a large collection of image files that are stored on defaultexternal. I build a list of the image file names and then use httputils to download the files from web server. It works, but just seems inefficient to download every single file in the list when actually only a few are new or changed. I would like to somehow compare the existing image on the device to the same image file on the server, and only download those that have changed or are new (present on the server but not present in defaultexternal). Determining the new files is no problem, but I don't know the way to compare existing files to the files on the server do determine if they have changed.
 

Bill Norris

Active Member
Licensed User
Longtime User
RE:

I think the modified time would be easiest for me. Not sure though of how to get that value from the device files or the server files.
 
Upvote 0

Bill Norris

Active Member
Licensed User
Longtime User
RE

I think you are correct. I don't see any functions in HTTPutils to get those attributes from the files on the server.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Remember it is still not so simple.
Lets say you get a list of files from the server, the local files are out of date so you start downloading. If it is a large file it will take a while to download, so the local mod time will not match the remote mod time even though it is the same file!
You will have to maintain some local state by saving the list from the server and comparing the prev server list from the new one to detect changes.

Sent from my GT-I9000 using Tapatalk 2
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…