Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got a problem with wget, I need to download an entire site with images and other files linked in main pages, I'm using these options:

wget --load-cookies /tmp/cookie.txt -r -l 1 -k -p -nc ''

(-l 1 is used for testing, I may need to travel to level 3 or even 4)

The problem is: I can't figure out how to bypass the 'random' GET parameter that is added after some recursion cycles, so my final result in the /tmp folder is like this:


Since the page it is always the same I don't need to get it other times, I tried with -nc option but it doesn't work, I also tried using -R (reject) but it only works with file extensions, not with URL parameters.

I looked extensively in the wget manual but I don't seem to find a way to do it; it is not mandatory to use wget, if you know how to do it in other ways, they are welcome.

share|improve this question
WHat are your purposes? The way I see it you've run into the problem of leeching from a site with anti-leeching code. Perhaps you might also tell us how this qualifies as a system administration question. – John Gardeniers Oct 23 '09 at 9:31
Actually the site I'm trying to download is that of my own employer, and yes, it has security constraints, I'm allowed to do this, we need a static working copy of the site. – Lex Oct 23 '09 at 12:33
I don't know if reallt qualifies as a sysadmin question, I thought it didn't belong to stack overflow and thought about asking it here, sorry if I was wrong, just move it to stackoverflow. – Lex Oct 23 '09 at 12:34
It may become a stack overflow question if you take a programmatic route. Otherwise it's probably a SuperUser question. – Kyle Smith Oct 23 '09 at 14:09
up vote 0 down vote accepted

Write a local proxy server that modifies the responses sent to wget.

Assuming your URLs are in links such as:

<a href="/path/to/">

Then you can run a Ruby proxy server like this:

require 'webrick/httpproxy'
s =
   :Port => 2200,
   :ProxyContentHandler =>{|req,res|
      res.body.gsub!(/[0-9\.]*/, "")
trap("INT"){ s.shutdown }
share|improve this answer
I thought about the same thing during the course of the day, I'll implement it with python though, saw this:… – Lex Oct 23 '09 at 16:22

Your Answer


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.