2

Is there a way to invoke unzip (from Info-ZIP) on a Linux system without having it restore the permissions stored in the zip file? The zip files I'm restoring are enormous, so going back over the contents with something like "chmod -R" will take a while. I do not control the source of the archives, so my only choice is to handle the permissions on extraction.

migrated from serverfault.com Sep 8 '14 at 8:20

This question came from our site for system and network administrators.

3

Restoring permissions is a feature of unzip (from the man page, version 6.00):

Dates,  times  and  permissions of stored directories are not restored
except under Unix. (On Windows NT and successors, timestamps  are  now
restored.)

and there is no option to switch if off.

It might be that an older version of unzip did not support restoring permission, but investigating that route is probably more cumbersome than trying to change the latest unzip source to do what you want.

If running chmod -R is unacceptable you can take a look at using Python's zipfile library, it is easy to use and gives you full control over the way you write the files that you extract from the zip file.

  • See this answer for how to make sure ZipFile restores attributes. – Anthon Jun 2 '17 at 6:25

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.