Can wget estimate a website’s size before mirroring it?

0
2
Asked By VelvetCedar42 On

I want to archive a website with a command such as `wget -m -k https://example-web.site`, but I'd like to estimate the required disk space first, possibly as a separate or background check. I found shell scripts that crawl a site and add up the reported file sizes, but I'm unsure how reliable that approach is. I also read that wget's `--spider` mode can create and remove temporary files, and now I'm concerned it might delete existing files or interfere with a download. Is spider mode safe, and is there a practical way to estimate how large a mirror will be?

3 Answers

Answered By QuietMarble8 On

A crawl-based estimate can be very misleading. Dynamically generated URLs may produce far more content than expected, or an effectively endless set of pages, while content hidden behind forms, scripts, authentication, or unlisted links may be missed entirely. The only dependable size is available on the server itself—for example, if all of the site’s files are under `/var/www`, the administrator could use `du -sh /var/www`. From outside the server, treat any result as a rough estimate rather than a guarantee.

Answered By MistyHarbor7 On

There isn’t a reliably accurate way to know the final size without transferring the files. You can perform a spider or header-only pass first, but that still takes time and may require contacting every resource. A second pass to download everything will therefore involve much of the work twice.

Answered By CopperLynx19 On

The deletion warning is probably about temporary files that wget creates while spidering, or about running it in a directory containing files that conflict with its output. It’s safest to run both the spider check and the actual mirror in a new, empty temporary directory. Spider mode is intended to inspect links, not erase arbitrary files, but avoid testing it in a directory containing anything important. Options such as `--no-clobber` may help prevent overwriting, although they don’t make a size estimate accurate.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.