0

How can I compress a directory content without compress the full path folder structure too.

I am using this command to zip a folder content under var/www/ directory, but when I unzip the application.zip I got a 2 level folder structure

/var/www/my important files

zip -r /var/appbackup/application.zip /var/www/

I would like to keep only files without "var" and "www" folders. How can I do that?

0
cd /var/www
zip -r application.zip *

It should work fine.

0

if you're ok with using 7z instead of zip:

7z a -tzip -mx5 /home/"$USER"/Desktop/target_file.7z "/directory/to/be/compressed";

this yields a normal-compressed (-mx=5) zip (-tzip) archive. you can switch the parameters around by refering to the man file or this guide http://www.dotnetperls.com/7-zip-examples

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.