I'm trying to mirror a site but the css linked has the url:

Using wget to download the site saves the css file with the filename screen.css?v=c44dc08367

I tried using --adjust-extension flag but that saves the file as screen.css?v=c44dc08367.css Is it possible to save it the right way as screen.css using wget?

I'm using GNU Wget 1.14 built on darwin12.5.0.

EDIT: I can't specify the file name as I'm mirroring the whole site, so the actual command goes like this. The css link is inside the page (which is fetched automatically by wget)

wget \
               --recursive \              # follow links to download entire site
               --page-requisites \        # grab everything: css / inlined images
               --no-parent \              # don't go to parent level
               --directory-prefix static \# download contents to static/ folder
               --no-host-directories \    # don't create domain named folder
               --adjust-extension \
  • Did you resolve this in the end without manual / custom scripts?
    – Horse
    Feb 8, 2016 at 17:08
  • I had the same issue and solved it by using the httrack tool. Two more points: did you miss --convert-links? And moreover, though ? is in the filename here, the ? is replaced with %3F in the html source, so it is recognized as being part of the filename.
    – Thorsten
    Nov 23, 2022 at 9:37

1 Answer 1


Unfortunately, wget will make no assumptions about what you want to download unless you tell it to. It doesn't care if your file is an image, a document, a zipped file, et cetera.

The file is saved as whatever the URL ended with – so anything from the last slash to the end of the URL. In your case, that's .css?v=c44dc08367. The part after the actual file extension (.css) is contained in the URL, but it's a HTTP query parameter. For wget, however, it will determine the output filename.

If you want to specify an output filename for wget, add the -O (uppercase O) option:

wget -O screen.css

Finally, there's the --content-disposition option which might result in the proper filename being set. But this entirely depends on the server you're downloading from sending the correct header information.

Excepts from here: Why does wget'ing an image give me a file, not an image?

  • Thanks Gaurav, but I don't think -O helps in my case. Please refer to the EDIT. Also, I get "screen.css\?v=c44dc08367.css" using --content-disposition which also doesn't help me. Is there any way wget can ignore the query parameter for the filename? Jan 18, 2014 at 7:39
  • No I think you can't do that in wget but you can make up a script to do the thing. Jan 18, 2014 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .