0

I have a script that works in a loop and checks for mysqlbackup copies on another server. couple of times a day wget downloads the file even though no change has been made.

what I've tried is using --timestamping and --timestamping --no-use-server-timestamps

2
  • OK, that's what you've done, what do you want to do? Do you want to download a file only if it is newer than the local copy?
    – terdon
    Dec 6, 2012 at 18:08
  • yes. i want to download a file only if it's newer
    – teslasimus
    Dec 6, 2012 at 18:23

1 Answer 1

1

rsync will get you what you need. It's mostly used to make delta backups, but what's important (for you) is that it can be used to only transfer a file or file(s) when the remote copy has been changed. rsync

From the wget manual:

The time-stamping in GNU Wget is turned on using ‘--timestamping’ (‘-N’) option, or through timestamping = on directive in .wgetrc. With this option, for each file it intends to download, Wget will check whether a local file of the same name exists. If it does, and the remote file is not newer, Wget will not download it.

If the local file does not exist, or the sizes of the files do not match, Wget will download the remote file no matter what the time-stamps say.

It should be doing what you're asking it to... right?

3
  • the same way you could use scp. i'm searching a way do it with 'wget' like method
    – teslasimus
    Dec 6, 2012 at 18:35
  • @lan, how can i ignore the "size match"?
    – teslasimus
    Dec 6, 2012 at 19:26
  • There is no way. wget is fine but it has built-in limitations. Why are you resisting rsync? Resistance is futile. :)
    – Ian Atkin
    Dec 6, 2012 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .