Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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 '12 at 18:08
    
yes. i want to download a file only if it's newer –  teslasimus Dec 6 '12 at 18:23
add comment

1 Answer

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?

share|improve this answer
    
the same way you could use scp. i'm searching a way do it with 'wget' like method –  teslasimus Dec 6 '12 at 18:35
    
@lan, how can i ignore the "size match"? –  teslasimus Dec 6 '12 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 '12 at 19:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.