0

I'm trying to force wget to clobber a download and I haven't been able to make it do it with what I can find in the man pages. I'd like something cleaner than writing to and redirecting STDOUT. Anyone got a tip?

I know I can use curl for this; I am really just looking for a wget solution.

This question looks like a duplicate of 171369 -- but the accepted answer there DOES NOT work. This might be due to the question's age; that question is over 9 years old and I reckon wget might have changed since it was asked and answered.

For what it's worth, here's the wget build info from the machine I'm working with:

-sh-4.2$ wget --version
GNU Wget 1.14 built on linux-gnu.

+digest +https +ipv6 +iri +large-file +nls +ntlm +opie +ssl/openssl

Wgetrc:
    /etc/wgetrc (system)
Locale: /usr/share/locale
Compile: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
    -DLOCALEDIR="/usr/share/locale" -I. -I../lib -I../lib -O2 -g -pipe
    -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
    --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
Link: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
    -fstack-protector-strong --param=ssp-buffer-size=4
    -grecord-gcc-switches -m64 -mtune=generic -lssl -lcrypto
    /usr/lib64/libssl.so /usr/lib64/libcrypto.so /usr/lib64/libz.so
    -ldl -lz -lz -lidn -luuid -lpcre ftp-opie.o openssl.o http-ntlm.o
    ../lib/libgnu.a

Thanks!

sjlxndr
  • 36
  • 5

1 Answers1

1

The closest thing available that does ALMOST what I want it to is the --backup=1 flag.

Example:

I have previously downloaded https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz to /tmp.

If I run:

wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz -P /tmp --backups=1

This moves the previous download to /tmp/GeoLite2-City.tar.gz.1 and writes the new download to /tmp/GeoLite2-City.tar.gz.

Good enough I suppose.

sjlxndr
  • 36
  • 5