12-16-2014 12:12 PM
I am trying to do the following
- Download a Zip File from Web. I have done this using FILENAME URL - Working Fine
- Unzip the File and get all the member data. I have done this using FILENAME ZIP, DOPEN, DREAD and FOPEN in a DATA Step - Working Fine.
- Get the Last Updated TimeStamp of every member in the ZIP File. - This is the one I need help.
- When I tried to get the File Attributes (using FOPEN, FINFO) on the unzipped file, I get current date as I have created the file during the unzip process.
- When I tried to get the File Attributes (using FOPEN, FINFO) on the zip file immediately after download, File Identifier comes as ZERO.
Hope this makes.
Any help is appreciated.
12-17-2014 04:38 AM
Once you have downloaded the zip file (say as foo.zip), you can use unzip -l foo to list the contents of the zip file:
Length Date Time Name
-------- ---- ---- ----
29 09-10-13 08:32 test.dat
37 03-04-14 13:04 xxx.lst
72949 11-14-12 14:39 wagner.log
73015 3 files
You can use a construct like this:
filename oscmd pipe "unzip -l foo"
infile oscmd truncover end=last;
format file_name $50. file_date date9. file_time time5.;
if _n_ > 3 and not last and substr(_infile_,2,8) ne '--------';
file_date = input(substr(_infile_,12,8),mmddyy8.);
file_time = input(substr(_infile_,21,5),time5.);
file_name = substr(_infile_,29);
unzip is a standard tool on UNIX systems.