idlneturl question [message #90474] |
Tue, 03 March 2015 21:07  |
Dae-Kyu Shin
Messages: 25 Registered: February 2015
|
Junior Member |
|
|
hi
can i get last modified time of ftp file using idlneturl object ?
for example in ubuntu
$ ftp spdf.gsfc.nasa.gov
Name : anonymous
ftp> cd pub/data/omni/omni_cdaweb/hro_5min/1981
ftp> modtime omni_hro_5min_19811201_v01.cdf
then i can see this information
"omni_hro_5min_19811201_v01.cdf 02/17/2014 07:39:28 GMT"
can i get this information using 'idlneturl' or another procedure??
thanks
|
|
|
Re: idlneturl question [message #90476 is a reply to message #90474] |
Wed, 04 March 2015 03:45   |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
I have not found a way to look at file information using IDLnetURL without downloading the file first. With IDLnetURL, you have to perform a Get, then look at the response header. Below is an example of how to get the response header.
IDL> oURL = IDLnetURL()
% Loaded DLM: URL.
IDL> info = oURL -> Get(URL=' ftp://spdf.gsfc.nasa.gov/pub/data/omni/omni_cdaweb/hro_5min/ 1981/omni_hro_5min_19811201_v01.cdf')
IDL> oURL -> GetProperty, RESPONSE_HEADER=rh
IDL> print, rh
220-WARNING! This is a U.S. Government Computer
This U.S. Government computer is for authorized users only.
By accessing this system, you are consenting to complete monitoring with no expectation of privacy.
Unauthorized access or use may subject you to disciplinary action and criminal prosecution.
220 Welcome to our FTP Server
331 Anonymous login ok, send your complete email address as your password
230 Anonymous access granted, restrictions apply
257 "/" is the current directory
250 CWD command successful
250 CWD command successful
250 CWD command successful
250 CWD command successful
250 CWD command successful
250 CWD command successful
200 EPRT command successful
200 Type set to I
213 2128388
150 Opening BINARY mode data connection for omni_hro_5min_19811201_v01.cdf (2128388 bytes)
226 Transfer complete
Well, that was interesting...
Apparently NASA will not give you a meaningful response header. This is how I normally do it, though. There should be a "Last-Modified" field that you can look for to parse the information you want.
IDL> file = oURL -> Get(URL=' http://emfisis.physics.uiowa.edu/Flight/RBSP-A/L3/2013/02/02 /rbsp-a_magnetometer_4sec-geo_emfisis-L3_20130202_v1.3.2.cdf')
IDL> ourl -> GetProperty, RESPONSE_HEADER=rh
IDL> print, rh
HTTP/1.1 200 OK
Date: Wed, 04 Mar 2015 11:44:03 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Thu, 29 Jan 2015 21:26:19 GMT
ETag: "53c077a-f7fa2-50dd123904e55"
Accept-Ranges: bytes
Content-Length: 1015714
Content-Type: application/x-cdf
|
|
|
|
Re: idlneturl question [message #90609 is a reply to message #90596] |
Sat, 14 March 2015 05:48  |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
> There is a way to read the response without downloading entire file. It involves interrupting the IDLnetURL GET request and returning after reading the response header.
This is great! Thanks for sharing!
|
|
|