Maintain zip file structure

Posted by Mika H. on Super User See other posts from Super User or by Mika H.
Published on 2012-11-05T03:23:05Z Indexed on 2012/11/05 5:04 UTC
Read the original article Hit count: 472

Filed under:
|

I have a directory

main_folder
  first_folder
    second_folder
      empty.txt
      another_folder
        another_empty.txt

I want to zip second_folder, and I'm in main_folder, so I zipped with the command

zip -jr first_folder/zip_file first_folder/second_folder

The zip file contains

empty.txt
another_empty.txt

But I want

empty.txt
another_folder
  another_empty.txt

How can I have that?

© Super User or respective owner

Related posts about unix

Related posts about zip