7-Zip command line to zip all the content of a folder (without zipping the folder itself) [duplicate]

Possible Duplicate: Create an archive from a directory without the directory name being added to the archive

I have a folder that I want to zip completely:

MyFolder
       |
       |--- SubFolder1
       |--- SubFolder2
       |--- file1
       |--- file2

I want to zip everyting into myzip.7z, but I don't want 'MyFolder' to be inside the archive:

myzip.7z
       |
       |--- SubFolder1
       |--- SubFolder2
       |--- file1
       |--- file2

instead of

myzip.7z
       |
       |--- MyFolder
                   |
                   |--- SubFolder1
                   |--- SubFolder2
                   |--- file1
                   |--- file2

How do I do that?


Solution 1:

This is how I did it.

cd MyFolder
7z a -r ../myzip *

This creates the archive (myzip.7z) in the parent of MyFolder rather than in MyFolder directly.

Alternatively (without first changing into MyFolder):

7z a myzip ./MyFolder/*