7-Zip Command-Line Usage

http://www.dotnetperls.com/7-zip-examples
Command a: add
This command stands for "archive" or "add." Use it to put files in an archive. 
7za a -t7z files.7z *.txt

Command d: delete
7z d archive.zip *.bak -r
-r:          traverse all subdirectories

Command e: extract
7z e archive.zip

Command l: list contents of archives
7za l files.7z

Command t: test integrity
7z t archive.zip *.doc -r

Command u: update
7z u archive.zip *.doc

Command x
This command is like "e" except it preserves the full paths.
7z x archive.zip

Switch m: compression level
-mx0 to -mx9

Switch t type
-t7z -tzip -ttar -tgzip -tbzip2 -tiso -tudf

Switch o
We show the "o" switch on the 7-Zip command line. Sometimes you do not want to extract to the current directory. This is where -o can come in handy. 
7z x archive.zip -oC:\Doc
-oC:\soft:   the destination folder (-o is the switch and C:\soft is the argument)

7z e archive.zip -oC:\soft *.cpp -r

Switch ao
The "ao" switch allows you to specify whether you want to overwrite old files.
Switch -aoa:
This switch overwrites all destination files.
Use it when the new versions are preferred.

Switch -aos:
Skip over existing files without overwriting. Use this for files where the earliest version is most important.

Switch -aou:
Avoid name collisions. New files extracted will have a number appending to their names. You will have to deal with them later.

Switch -aot:
Rename existing files. This will not rename the new files, just the old ones already there.

No comments:

Post a Comment