techiall / Blog

🍋 [My Blog] See discussions
https://github.com/techiall/Blog/discussions
MIT License
8 stars 1 forks source link

7z 常用命令行总结 #33

Open techiall opened 5 years ago

techiall commented 5 years ago

压缩文件

7z a <archive_name> [<file_name>...]

# fila_name 支持文件夹
# 将 后缀为 php 的文件压缩,压缩包的名称为 main.zip
7z a main.zip *.php

解压文件

7z x <archive_name>

# 解压文件,逐层加压,目录结构不变
# 7z e 会改变目录结构。
7z x main.zip

7z x main.zip -o"test"
# 将文件解压出来,解压到 test 目录下
# -o 指定文件夹,和文件夹之间不能存在空格

测试压缩包

7z t <archive_name>

# 测试 main.zip 压缩包
7z t main.zip

删除压缩包的文件

7z d <archive_name> [<file_name>]

# 从 main.zip 中删除后缀名为 .php 的文件
7z t main.zip *.php

查看压缩包的文件

7z l <archive_name>

# 查看 main.zip 包含的文件
7z l main.zip