Search code examples
javasymlinkunzip

How to unzip folder with symlinks


I Have: zipped folder that contains relative symbolic links (symlinks)

What i want to achieve: unzip folder and still have symbolic links

I prefer to use java.util.zip but im not even sure if it is possible.

So, the question is: how to unzip folder, and do not replace symlink with copy of a file?

If it is not possible for zip, is it possible for tar?


Solution

  • It seems that apache commons-compress has support for symlinks - in the sense that it can tell you if an entry is a symlink, and what it points to. You would then re-create the symlinks using Files.createSymbolicLink

    So - definitely possible, if a bit of a hassle since uncompressing a zip-file in commons-compress is sort of convoluted.