archiving symlinks with python zipfile

后端 未结 3 2097
野性不改
野性不改 2021-01-18 07:14

I have a script that creates zip files of dirs containing symlinks. I was surprised to find that the zipfiles have zipped the targets of the links as opposed to the links th

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-18 07:28

    zipfile doesn't appear to support storing symbolic links. The way to store them in a ZIP is actually not part of the format and is only available as a custom extension in some implementations. In particular, Info-ZIP's implementation supports them so you can delegate to it instead. Make sure your decompression software can handle such archives - as I said, this feature is not standardized.

提交回复
热议问题