title: Using R to Download and extract zip file that contains a folder
body: <p>In Rstudio I wrote:</p>
  
  <pre><code>urlcoP &lt;- "http://www.cophieu68.vn/datax123456/metastock_all_data.zip"
  temp &lt;- tempfile()
  download.file(urlcoP,temp)
  data &lt;- read.table(unz(temp, "metastock_all_data.txt"))
  </code></pre>
  
  <p>But it's get the error:</p>
  
  <pre><code>Error in open.connection(file, "rt") : cannot open the connection
  In addition: Warning message:
  In open.connection(file, "rt") :
    cannot locate file 'metastock_all_data.txt' in zip file 'C:\TEMP\RtmpaaH3PW\file135c1e97348'
  </code></pre>
  
  <p>The reason is that the <code>metastock_all_data.txt</code> is in a folder called <code>datax123456</code> in the zip.</p>