Suppose I have a zip archive file with many files in it. I can get a list of the files in the archive with:


I can get data out of one of the files inside the archive with:


I can get the date the zip file was created with


But I can't figure out how to get the dates of the files inside the zip file.

  • 4
    $\begingroup$ I can verify there is no way to do this currently without extracting the file first. This is a good suggestion, we'll look into this for future versions. $\endgroup$ – GenericAccountName Apr 4 at 2:34

I know you are probably looking for a pure Mathematica solution - looks like it's not supported by Mathematica (yet). However, don't forget that you can run any external program and analyze its output in Mathematica, so e.g. on macOS I can use unzip, which provides data in the following format:

17:06 /tmp $ unzip -l archive.zip 
Archive:  archive.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  04-03-2019 17:06   a.txt
        0  04-03-2019 17:06   b.txt
        0  04-03-2019 17:06   c.txt
---------                     -------
        0                     3 files

17:07 /tmp $ 

and therefore I can write this Mathematica function to do date processing for me:

zipDates[filename_] := 
      RunProcess[{"unzip", "-l", filename}, "StandardOutput"], 
      "\n"][[4 ;; -3]],
    " "][[All, 3]]


  • $\begingroup$ Thanks for the reminder. Using an external function is a great idea. I'm using windows so I'll give this a try with 7-Zip. $\endgroup$ – Rudy Potter Apr 9 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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