You can compress recursively a folder keeping ownership and permissions using the following example