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?
This question is related to
windows
http
command-line
windows-vista
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.
There is a Win32 port of wget that works decently.
PowerShell's Invoke-WebRequest -Method Head
would work as well.
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)
There is a Win32 port of wget that works decently.
PowerShell's Invoke-WebRequest -Method Head
would work as well.
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://....
There is a Win32 port of wget that works decently.
PowerShell's Invoke-WebRequest -Method Head
would work as well.
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://....
Source: Stackoverflow.com