bulk download .mp3 files

Or… more stupid wget tricks.

Say you have a url where a bunch of .mp3 files live, http://www.example.com/media/audio, and you want to download all the .mp3 files in there. Try this:

wget -r -l1 -np -A.mp3 -nd -erobots=off http://www.example.com/media/audio

This command does a bunch of different things, all derivable from the man page, but as usual not entirely clear.

Basically it says, recursively (-r) go out to the url specified and go only 1 level down (-l1), do not link up to any parent (-np), grab only files of type mp3 (-A.mp3), save everything to the same directory (-nd, don’t create a directory hierarchy patterned after the source), and ignore robots.txt (-erobots=off).

A good article that helped me with this was Jeffrey Veen’s MP3 Blogs and wget, which I highly recommend.