aspose file tools*
The moose likes Java in General and the fly likes File Update Detection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "File Update Detection" Watch "File Update Detection" New topic
Author

File Update Detection

Persio Berberian
Greenhorn

Joined: Aug 27, 2011
Posts: 9
Hi,
I have a program that try to detect any of its files updates(Datas), because some updates are necessary to make the program work correctly, well for long time I've been comparing the last change of File in my FTP With the user File in his System.
Well but that way is kindly complicated, because if FTP Update for some reason, all files are going to be updated for the user(Also some users experienced problems, like not finding updates), then I decided to make a new system and started with a file checksums comparator, well it take (UserFile CheckSum, then take URL File Checksum) and compare each other, well it works but the problem is that I have to compare the same amount of bytes, and to make 100% sure that the file is the same I have to compare the whole file, and to compare the Whole File from URL Take too much time to do in each program startup, and without some updates the program may crash so those are important.

So... I'm here to ask you a suggestion on how I Could make a decent file updater
I'm trying to avoid store each file version in files or something like that...
Thanks =D

Edit: What I was thinking, is write all files CheckSum in a file, then user when startup program and check file and read all checksums and compare them ^^ The bad thing of that is... That on every update I gotta create a new list of CheckSums ^^
Or I could make it connect to a server that will send the list of checksums ^^ but that's a bit annoying ;/
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

If you're using Java 7 you can use java.nio.file.WatchService for this.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Persio Berberian
Greenhorn

Joined: Aug 27, 2011
Posts: 9
Well but this WatchService is a listener for local files, I need a listener for files in my FTP, because client is supposed to download updated files ^^
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

Doesn't your FTP client software give you a way to find the last changed date of a file on the server? Using that date would be easier than using a checksum.
Persio Berberian
Greenhorn

Joined: Aug 27, 2011
Posts: 9
As I said that's what I'm doing for loong time, checking last file changed date, but that way is not good.
Oh well then you agree with me about make an Update Server :p
As I said, I don't like the "last changed" way to make those updates, if I make an update server I can compare by checksum as the server will send checksums instead of client read them from file itself :p
PS: Still searching for more suggestions :p
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39846
    
  28
Too difficult for “beginning”. Moving thread.
Persio Berberian
Greenhorn

Joined: Aug 27, 2011
Posts: 9
Thanks, maybe I'll get more opinions, by the way I already created my Update Server, when client login it open connection to update server then send a packet asking for all file checksum, then server parse packet and send the checksum that are stored in a list that refresh every 20 seconds, then client compare each checksum received that come with filename, with local computer files, if there are any file with different checksum the client will send another packet requesting the download of file that's different :p, then server will parse this packet and send file to client :p What about?




But I'm crazy for more suggestions, because Idk... what if update server become off-line I need an optional way :p
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Update Detection