14

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?

dbr
  • 165,801
  • 69
  • 278
  • 343
Henning
  • 11,496
  • 5
  • 27
  • 25

5 Answers5

11

There is a Win32 port of wget that works decently.

PowerShell's Invoke-WebRequest -Method Head would work as well.

Tomalak
  • 332,285
  • 67
  • 532
  • 628
10

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)

Falcon
  • 1,317
  • 1
  • 13
  • 30
Laurence
  • 109
  • 1
  • 2
9

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.

Paketizer
  • 5
  • 3
CesarB
  • 43,947
  • 7
  • 63
  • 86
  • 1
    Thanks! 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
5

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
David Bell
  • 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
1

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.

Vinko Vrsalovic
  • 330,807
  • 53
  • 334
  • 373