directory of files in a zip file?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

directory of files in a zip file?

Spencer Graves
Hi, All:

      How can I get the list of files contained in a zip file?

      "zip.file.extract" will extract a specific 'file' from 'zipname',
but how can I get the names of the files in 'zipname'?

      Thanks,
      Spencer

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: directory of files in a zip file?

Prof Brian Ripley
On Tue, 6 Jan 2009, Spencer Graves wrote:

> Hi, All:
>     How can I get the list of files contained in a zip file?
>     "zip.file.extract" will extract a specific 'file' from 'zipname', but
> how can I get the names of the files in 'zipname'?

Package Rcompression will I believe allow you to do this.  (An Omegahat
package, with a Windows binary on CRANextras.)  R itself does not contain
code to do so.

Another approach is to call system("unzip ....", intern=TRUE) and process
the result.

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: directory of files in a zip file?

Spencer Graves-3
Dear Prof. Ripley:

      Thanks very much.

      The "getZipInfo" function in the "Rcompression" package gave me
information on all of the files in my zip file, as you suggested.

      Then "unzip" in the "memisc" package extracted the desired file
and returned a character string giving the name of that temp file, which
I could then use in "readLines" or some other function.

      Thanks again,
      Spencer Graves

Prof Brian Ripley wrote:

> On Tue, 6 Jan 2009, Spencer Graves wrote:
>
>> Hi, All:
>>     How can I get the list of files contained in a zip file?
>>     "zip.file.extract" will extract a specific 'file' from 'zipname',
>> but how can I get the names of the files in 'zipname'?
>
> Package Rcompression will I believe allow you to do this.  (An
> Omegahat package, with a Windows binary on CRANextras.)  R itself does
> not contain code to do so.
>
> Another approach is to call system("unzip ....", intern=TRUE) and
> process the result.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.