1

First I used zip to archive folder(s) in Ubuntu. Then I used 7zip to extract those folders on Windows. There are symbolic links in the folder(s). I'm sure everything pointed by any symbolic link in the folder(s) is in the folder(s) too.

How can I set up the zip flag so that after extracting the folders under Windows, the symbol links work as before? This means that the symbol links should not be followed, but archived as symbol link information, which I'm not sure is supported by the zip format.

2

Can I be sure everything pointed by any symbolic link in the folder(s) is in the folder(s) too?

Short answer: yes, if you do not specify the --symlinks option.

By default, the zip command will dereference symbolic links. This means that symbolic links are replaced by the actual files or folders they link to. Thus, you could be sure that all files and folders that are referenced by your symbolic links on your linux system will actually be included as "real" files and folders in your zip file. When you extract the zip file on Windows, any of these files and folders will appear as "real" files and folders.

How can I set up the zip flag so that after extracting the folders under Windows, the symbol links work as before?

Short answer: you can't unless 1) the receiving file system supports linux symbolic links and 2) the target files/folders of the link are present

The ZIP format supports storing the symbolic link. To store symbolic links as such, you can use the --symlinks option. Symbolic links under Linux, however, only work on file systems that support these symbolic links. Thus, such archive needs to be extracted on a suited file system for these links to work again (and then of course, provided that there are corresponding target files on the system where the zip file is extracted).

  • "Can be sure" is not a typo - means I'm sure all referenced real data are in those added folders - means its OK not to follow symbol links to prevent missing targets. – jw_ Jan 18 '20 at 12:14
  • Windows have symbol links to, if zip format support them, then main stream Windows zip archivers should create Windows symbol links when there is one in the zip file? – jw_ Jan 18 '20 at 12:15
  • 1) "Can be sure" as such is abbreviated language and not grammatically a full sentence. Hence it can be misunderstood. Anyway, as currently written, this is now probably also very clear to other readers. 2) Mainstream Windows zip archive tools theoretically could have a feature to convert linux links to Windows links, but you say it yourself: they are mainstream, so won't bother. – vanadium Jan 18 '20 at 12:19
  • Yes "Can be sure" is really confusing to others. Fixed now. – jw_ Jan 18 '20 at 12:22
  • Indeed, now you made it perfectly clear -) – vanadium Jan 18 '20 at 12:24

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.