Howy
Howy

Reputation: 33

Recursive wget strip GET parameters

I am downloading a website I have using wget -r http://example.com but in order for the css files to not be cached, the website adds GET parameters to those files such as styles.css?foobar.

How can I make it download the file and strip ?foobar from it?

Upvotes: 3

Views: 540

Answers (1)

200_success
200_success

Reputation: 7582

You could rename the files after wget completes.

find . -name '*\?*' | while read -r path ; do
    mv "$path" "${path%\?*}"
done

Upvotes: 4

Related Questions