-2

I downloaded a zip file (20000101[1].zip) with following subfolder structure

\home\ftp\pub\account\lmp\20010101.csv. 

Do yo guys have any idea how to extract the file 20010101.csv.

Thanks.

tumultous_rooster
  • 12,150
  • 32
  • 92
  • 149
user3681349
  • 11
  • 1
  • 1

1 Answers1

5

If you want to read the csv without extracting it (sometimes it's quite useful), assuming eg a folders structure like this one

l@np350v5c:~$ zipinfo foo.zip 
Archive:  foo.zip
Zip file size: 481 bytes, number of entries: 3
drwxr-xr-x  3.0 unx        0 bx stor 14-May-27 22:52 foo/
drwxr-xr-x  3.0 unx        0 bx stor 14-May-27 22:52 foo/bar/
-rw-r--r--  3.0 unx       21 tx stor 14-May-27 22:52 foo/bar/asd.csv
3 files, 21 bytes uncompressed, 21 bytes compressed:  0.0%

... you can try unz which creates a connection to a file inside a .zip file

con <- unz(description="foo.zip", filename="foo/bar/asd.csv")
db <- read.csv(con)
close(con)

HTH, Luca

Luca Braglia
  • 3,133
  • 1
  • 16
  • 21
  • Thanks for the answer. It still works if you simplify it to db <-read.csv(unz(description="foo.zip", filename="foo/bar/asd.csv")) – Justin Meyer Jan 10 '18 at 17:27