I'm trying (and failing) to extract a list of files in a zip archive
to a pipe or file.

This DOES work as long as the output #channel is to a SCR or CON
channel:

 EW UNZIP,#channel;'-l ram1_test_zip'

If #channel is open to a pipe or file, it doesn't work:

OPEN_NEW #3,ram1_extract_dat
EX UNZIP,#3;'-l ram1_test_zip'
CLOSE #3

(the length of file ram1_extract_dat is always 0 after this example,
showing the data went somewhere but not to the channel specified).

This does seem to work, but it is so long-winded there must be a
better and simpler way:

100 REMark send zip listing output to a 10KB pipe
110 OPEN #4,pipe_10240
120 REMark Q_PIPE is a QLiberator command, like CONNECT in Turbo TK
130 Q_PIPE #4 TO #3 : REMark input from same pipe via #3
140 EW win1_exec_unzip,ram1_example_zip,#4;'-Z -1 ram1_example_zip'
150 CLOSE #4 : REMark ensure PIPE gives EOF
160 REPeat loop
170   IF EOF(#3) THEN EXIT loop
180   INPUT #3,t$
190   PRINT t$
200 END REPeat loop
210 CLOSE #3

In line 140, my copy of UNZIP is in WIN1_EXEC_ directory.
Output of zip file ram1_example_zip is sent to S*BASIC channel #4,
which is to a 10KB pipe.
The other end of the pipe is open for input via #3.
The -Z -1 bit in the quotes is: -z=ZipInfo mode to list information 
about a zip archive and -1=list filenames only.

Not quite sure why example_zip has to be referred to twice, although
the first reference is setting up where data is piped from and to by
unzip. It certainly only seems to work if referred to both in the EW 
command and the parameter string.

What I'm trying to do is to get a listing of files in a ZIP file
without having to see UNZIP appear on the screen.

Help!

-- 
Dilwyn Jones



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.4/176 - Release Date: 20/11/2005

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to