1

I'm trying to use wget to download entire directories with their contents from a webserver. Some of the files there have zero length.

Is there a way to make wget create the 0-byte file on the client? As I'm trying to do it now, wget gets 200 OK ... Content-Length: 0 from the server, considers the file already downloaded and does nothing.

$ wget -dS http://gateway/zero
Debugging support not compiled in. Ignoring --debug flag.
--2015-01-28 16:58:44--  http://gateway/zero
Resolving gateway... 172.16.19.2
Connecting to gateway|172.16.19.2|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Date: Wed, 28 Jan 2015 15:58:44 GMT
  Server: Apache/2.4.7 (Ubuntu)
  Last-Modified: Wed, 28 Jan 2015 15:58:34 GMT
  ETag: "0-50db87194310f"
  Accept-Ranges: bytes
  Content-Length: 0
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive

    The file is already fully retrieved; nothing to do.
$ ls -l zero
ls: zero: No such file or directory

1 Answer 1

0

You can try it with the --no-cache option of wget:

wget --no-cache -dS http://gateway/zero

See the man page of wget:

`--no-cache'

       Disable server-side cache. In this case, Wget will send the remote server
       an appropriate directive (‘Pragma: no-cache’) to get the file from the
       remote service, rather than returning the cached version. This is
       especially useful for retrieving and flushing out-of-date documents on
       proxy servers.

       Caching is allowed by default.
1
  • Thanks for the suggestion, but no - adding --no-cache to the options doesn't change the behaviour in my case.
    – myxal
    Commented Jan 29, 2015 at 7:25

You must log in to answer this question.

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