0

I've got a problem and am not sure what it is, but hope someone can help me think this through because this has me stumped.

Backstory:

I wrote a Java app (Android) that unzips some zip files downloaded from the network. Until now, this was working great. Then, this week, the archives that I'm creating on my pc (in Ubuntu 12.04) unzip on the Android phone into a flat hierarchy instead of preserving the folders. I'm creating the archives the same way (right-click on folder > compress) but even though my old archives (created in 10.04) still unzip as expected, the new ones don't. On Ubuntu, the new zip files look the same to me as the old ones. When unzipped on my pc the folders in these new archives are restored the same as the old ones... it's the Android app that extracts the old ones fine and the new ones flat. What I really want to know, though, is what the difference between the archives is.

Question:

How could one determine why one zip archive would be extracted with folder hierarchy preserved, when an identical one (to all appearances on Ubuntu 12.04) is extracted with no hierarchy? Are there different ways in which a .zip file can "have" folders, but Ubuntu doesn't distinguish between them?

1 Answer 1

1

I suggest installing the unzip package, and then running unzip -l <archive_name> to inspect the true structure of the zip file.

There are no different ways of storing folders in a zip file. The folders are there, or not there. Upon unzipping, however, there are different ways of handling the folders in the zip file (if any). For example, depending on what the user instructs it to do, the unzipper might ignore all folders and just extract files to a single directory (unzip -j would do this). Or it might extract all files into a directory that doesn't exist in the zip archive (unzip -d would do this).

1
  • Interesting, according to the -l option these files really are structured the same. I'm going to take this as a sign there's something amiss app-side and look again there. Thanks. (Also, unzip is a pretty handy package, I hadn't seen it before. Thanks for that too.)
    – Hydrangea
    Commented Jun 26, 2012 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .