What's the best way (or tool) on the Windows (Vista) command line to get size and modification time for a file on a remote webserver, without downloading it?
5 Answers
There is a Win32 port of wget that works decently.
PowerShell's Invoke-WebRequest -Method Head
would work as well.

- 332,285
- 67
- 532
- 628
If you cannot install aditional applications, then you can telnet (you will need to install this feature for your windows 7 by following this) the remote server:
TELNET server_name 80
followed by:
HEAD /virtual/directory/file.ext
or
GET /virtual/directory/file.ext
depending on if you want just the header (HEAD) or the full contents (GET)
-
Does this work for https? I tried port 443 to no avail. – theannouncer Mar 31 '17 at 21:32
On Linux, I often use curl with the --head parameter. It is available for several operating systems, including Windows.
[edit] related to the answer below, gknw.net is currently down as of February 23 2012. Check curl.haxx.se for updated info.
-
1Thanks! http://www.gknw.net/mirror/curl/win32/curl-7.19.0-ssl-sspi-zlib-static-bin-w32.zip has a statically linked version for Win32 that worked even better than wget. – Henning Oct 20 '08 at 12:27
1) See the headers that come back from a GET request
wget --server-response -O /dev/null http://....
1a) Save the headers that come back from a GET request
wget --server-response -o headers -O /dev/null http://....
2) See the headers that come back from GET HEAD request
wget --server-response --spider http://....
2a) Save the headers that come back from a GET HEAD request
wget --server-response --spider -o headers http://....
- David

- 51
- 1
- 1
-
(a) There is no `/dev/null` on Windows. (b) I'm not sure why you include the first two options as they said they want to issue a *HEAD* request, not a *GET*. Why download stuff you'll never use, especially if it might be large. – Joey Apr 13 '11 at 05:21
I'd download PuTTY and run a telnet session on port 80 to the webserver you want
HEAD /resource HTTP/1.1
Host: www.example.com
You could alternatively download Perl and try LWP's HEAD command. Or write your own script.

- 330,807
- 53
- 334
- 373