Skip to main content

7z

Compress Without Root Folder

This will compress with root folder:

# Compress ./relative/dir/myFile
7z a -r my7z.7z relative/dir/*
# Uncompress to ./relative/dir/myFile
7z x my7z.7z

This will compress without root folder:

# Compress ./relative/dir/myFile
7z a -r my7z.7z ./relative/dir/*
# Uncompress to ./my7z/myFile
7z x -omy7z my7z.7z

Examples

# archive only to .zip
7z a -tzip -mx=0 myzip.zip
# level-9 compress to .zip
7z a -tzip -mx=9 myzip.zip