I have a "ZIP"
file that contains directories.
Import["arch.zip", "FileNames"]
(* {"subdir\\test.txt"} *)
However, Import
errors that it cannot find the file in the subdirectory.
Import["arch.zip", {"subdir\\test.txt", "CSV"}]
Import::noelem: The Import element "subdir\test.txt" is not present when importing as ZIP. >>
However, if I add a file at the root of the zip
Import["arch.zip", "FileNames"]
(* {"subdir\\test.txt", "test2.txt"} *)
The root file imports it without issue
Import["arch.zip", {"test2.txt", "CSV"}]
(* {{1, 2, 3}, {4, 5, 6}} *)
How do I import files in subdirectories of zip files? I rather not import the entire zip as some of the files are very large and I don't need them.
I have not included a zip as I know people are squeamish about downloads.
May be a bug: Can anyone confirm 10.4.1 Win 7 Ent SP1
Export["testzip.zip",{"root.dat" -> {1}, "sub\\test.dat" -> {42}}]
thenImport["testzip.zip", #] & /@ Import["testzip.zip"]
->{{{1}}, {{42}}}
$\endgroup$ – george2079 Jun 10 '16 at 14:53ExtractArchive
? $\endgroup$ – yode Jun 11 '16 at 1:36ExtractArchive
. I think it may be a documentation link bug. $\endgroup$ – Edmund Jun 15 '16 at 21:00