Aram Wool wrote:
hi, I'm using wget with this url:

http://www.twis.org/audio/podpress_trac/web/147/0/TWIS_2007_09_11.mp3

the directory named 147 increases by 1 each week, corresponding to an mp3
with a new date. I can use macros to automatically deal with a changing
date, but haven't been able to find out how to make wget go to directory
148 the following week, etc. without manually changing the url. I'd expect
there's an easy solution to such a simple problem.

I don't think this is a problem for wget to solve (how would it?). What you can do though is keep track of what URL you downloaded last, and use that. Something like this:

$ mkdir /var/tmp/$(id -un)
$ echo 147 > /var/tmp/$(id -un)/teh_last_mp3
$ cat > getnext.sh
#!/bin/bash
lastnum=$(cat /var/tmp/$(id -un)/teh_last_mp3)
(( nextnum = lastnum + 1 ))
wget "url-using-$nextnum-and-date"
echo $nextnum > /var/tmp/$(id -un)/teh_last_mp3

...unless you wanted something based on the week number from the date, in which case 'info date' is your friend (hint: "%U").

--
Matthew
"Non sequitor. Your facts are out of order." -- Nomad

Reply via email to