Eduardo Perez
Eduardo Perez

Reputation: 573

Wget - Overwrite files that are different

So, I'm making an updater for my game using wget. The latest version of the game (with all it's files), is on my server. The thing is that I want wget to download only the files that are different from a directory on the server into the www folder in the root of the game files (This has to be recursive, since not all of the game's files are stored directly in that folder). So, when the command is being ran it should check to see if the file's hashsum (if possible, otherwise it should check the size) on the server matches the one in the game's files. If it doesn't, it should download the file from the server and replace the one in the game's directory. This way, the player won't have to re-download all of the game's files.

Here's the command I used for testing:

wget.exe -N -r ftp://10.42.0.1/gamupd/arpg -O ./www

The server is running on my local network, so I use that IP address. The thing is that it doesn't save the contents of /gamupd/arpg to the www folder, instead it seems to copy the directory tree of arpg.

Upvotes: 1

Views: 1421

Answers (1)

Ohad Eytan
Ohad Eytan

Reputation: 8464

Maybe the timestamping flag will satisfy you. From wget -help:

-N, --timestamping don't re-retrieve files unless newer than local

Upvotes: 2

Related Questions