Thread: wget question
View Single Post
  #1  
Old 19th February 2008, 15:29
bschultz bschultz is offline
Senior Member
 
Join Date: Jul 2006
Posts: 222
Thanks: 11
Thanked 10 Times in 10 Posts
Default wget question

I've got two questions on automating a bunch of mp3 downloads. I need to download five mp3's per week. The problem is the files are placed in a directory based on the week of the year. So, for this week, the wget syntax would be

Code:
wget ftp://username:password@domain.com/week0807/*mp3
Next week, it will be:

Code:
ftp://username:password@domain.com/week0808/*mp3
Is there a way to get the directory to change in my cronjob based on what week it is?

For the second part...and I have no idea how to do this...the files I'll download all have the same name (file1.mp3, file2.mp3...) each week and I don't want to overwrite the old file. Right now, I'm renaming the files to file1.mp3.old and file2.mp3.old, and then downloading the new files.

Is there a way to only rename the old files if the server can connect to the remote FTP site? Right now (not very often, but occasionally) the files get renamed, but then my server can't connect to the remote FTP server, resulting in broken links until I can connect to the remote site.

Thanks.

Brian
Reply With Quote
Sponsored Links