Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If anyone has heard of Bukkit, you know that their files are usually of three types: Development, Beta, and Realease. Click (here) for examples. I need a script that:

  • Loops through the directory
  • Gets the latest Stable version (probably just as simple as looking at the version number as they have a simple naming convention, each stable version is succeeded by -Rx.0, while developmental and beta versions are succeeded by -Rx.x)

After that I know I'll need to use wget to download the file.

Note: If your just going to post code, at least tell me what it does so I can use it later if I need to

share|improve this question
add comment

2 Answers

The script's main task is to figure out which of those links it should wget. Parsing web pages is really complicated. I wouldn't recommend bash for it!

Python is easy to write in comparison and has a robust HTML parsing library called Beautiful Soup.

Once you've "souped" the link, downloading it is trivial.

share|improve this answer
add comment

It took me some time to figure this out, but here it is ;)

-c , in case you want to stop and start from where you left it

-r -A "-R[0-9].0" , gets only files that have in the middle -Rx.0 and x belonging to {0,1,...9}

-np , means no parent directories (goes with the -r option)

-nd , stands for no directory

-e robots=off , turn off robots

So in your case you would do something like

wget -c -e robots=off -r -np -nd -A "*-R[0-9].0*" http://repo.bukkit.org/content/groups/public/org/bukkit/craftbukkit/

I can't get it from the site you posted, but I think it somehow redirects things here.

share|improve this answer
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.