I want to use wget
(from a php script) to download image files, but don't want to download files over a certain size.
Can I limit file size with wget
? If not, what is a better way?
filessize;wget
I want to use wget
(from a php script) to download image files, but don't want to download files over a certain size.
Can I limit file size with wget
? If not, what is a better way?
Best Answer
If you are scripting downloads, you should consider using
curl
instead. Wget can parse output and recursively fetch whole sites, but curl has way more options relating to the actual download of a specific file. Here is the relevant option in the man page:The note about this only working for some files is worth considering. The client is dependent on the server to report how big the file is going to be before it starts downloading. Most but certainly not all servers report this.