Skip to content

How to get the list of the files when you read zip file by gzfile or unz

2 messages · Shawn Lee, Brian Ripley

#
On Wed, 24 Aug 2005, Shawn Lee wrote:

            
There is no list when gzfile() is used: a gzipped file is not a zip
archive.

unz() opens a single specified file in a zip archive.

AFAIK R does not directly support listing files in a zip archive as R
itself has no need of this.  However,

   tmp <- system(paste("unzip -l", zip_file_name), intern=TRUE)
   substring(tmp[-c(1:3, length(tmp)-0:1)], 29)

looks about right.