Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Mathematica can import zipped files automatically, but when the content of the zip file it's another zipped file, I just get the list of files in the second zip:

In[317]:= Import["","*"]

How can I get the content of the last files ?

share|improve this question
up vote 18 down vote accepted

The documentation for the MIME type ZIP does not seem to say much about what you want to do, but luckily the first thing I tried worked!

First, I saved your zip file onto my desktop. Then, I extracted the first level of file names (note that "FileNames" is the default option, so is not explicitly needed)

In[1]:= fn1 = Import["/home/simon/Desktop/", "FileNames"]
Out[1]= {""}

Then the second level of file names

In[2]:= fn2 = Import["/home/simon/Desktop/", {fn1[[1]], "FileNames"}]

Finally, I extracted, for example, the third file in the inner archive

In[4]:= Import["/home/simon/Desktop/", {fn1[[1]], fn2[[3]]}]
Out[4]= {{"\"20120312\";\"C2\";\"20\";\"0100\";\"FuturoC IBEX MINI\";1;1", 
  "00;\"EUR\";\"1\";\"FFICSX\""}, {...}, ....}

I think that this final Import defaulted to a CSV import, when you seem to want to separate elements by semicolons (";"), so you should use:

In[5]:= Import["/home/simon/Desktop/",{fn1[[1]], fn2[[3]], "Table"}, 
           "FieldSeparators"->";"] // Short[#,3]&
Out[5]//Short= {{20120312, C2, 20, 100, FuturoC IBEX MINI, 
                 1, 1,00, EUR, 1, FFICSX}, <<916>>, 
                {20120312, C2, VI, 240, Contado VIVENDI, 
                 1, 1,00, EUR, 2, ESXXXX}}

Note that you could, e.g., use a While loop to automate the digging down to the lowest level of the archive.

share|improve this answer
Just to complete the response. I'm importing only the 4th file, but I can't read dates properly: Import["", \ {"", "CCONTRSTAT.C2", "Table"}, "FieldSeparators" -> ";", "NumberPoint" -> ",", "Numeric" -> True, "DateStringFormat" -> {"Year", "", "Month", "", "Day"}] Returns the first field as a number but it's a date. Also tried "DateStringFormat" -> {"Year", "Month", "Day"} but doesn't works... – SMiranda Mar 15 '12 at 12:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.