如何在 Ubuntu 中一次提取文件夹中的多个 7z 文件?

发布于 2024-10-04 11:48:07 字数 141 浏览 5 评论 0原文

如何提取大约 900 个 7z 文件,这些文件都位于同一文件夹中(全部都只有一个文件)而不需要一一提取?

我使用的是 Ubuntu 10.10。所有文件都位于 /home/username/folder1/folder2 中。

How can I extract about 900 7z files which are all located in the same folder (all have only one file inside) without doing it one by one?

I am using Ubuntu 10.10. All files are located in /home/username/folder1/folder2.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

内心旳酸楚 2024-10-11 11:48:07
7za -y x "*.7z" 

上面的代码对我有用

7za -y x "*.7z" 

The above code worked for me

巷子口的你 2024-10-11 11:48:07
for arc in *.7z
do
  7zwhatever "$arc"
done
for arc in *.7z
do
  7zwhatever "$arc"
done
白云不回头 2024-10-11 11:48:07

使用 parallel 是相当方便的方式,并且免费提供总进度表;)

ls *.7z | parallel -j+0 --eta '7z x {} >/dev/null'

Using parallel is rather convenient way with total progress meter for free ;)

ls *.7z | parallel -j+0 --eta '7z x {} >/dev/null'
鱼忆七猫命九 2024-10-11 11:48:07

7z x “*.7z”
这在 ubuntu 中对我有用

7z x "*.7z"
this worked for me in ubuntu

爱要勇敢去追 2024-10-11 11:48:07
for f in *.7z
do
    7zr e "$f" &
done

这会将所有 7z 格式的 .7z 文件提取到当前目录,而不等待完成。

您的计算机可能已被拥有。您已被警告!

for f in *.7z
do
    7zr e "$f" &
done

This will extract all .7z files if they're 7z format to the current directory, without waiting for completion.

Your computer could be owned. You have been warned!

渡你暖光 2024-10-11 11:48:07

如果您希望将多个 7zip 存档解压到 Linux 中同名的文件夹中,您可以使用:

for archive in *.7z; do 7z x -o"`basename \"$archive\" .7z`" "$archive"; done

例如,如果您有两个 7zip 存档 a.7zb.7z,它会创建两个文件夹ab,并将a.7z解压到文件夹ab.7z 进入文件夹 b

上面的命令来自用户这个关于超级用户的答案用户Vojtech

If you wish to extract multiple 7zip archives to folders with the same names in Linux, you can use:

for archive in *.7z; do 7z x -o"`basename \"$archive\" .7z`" "$archive"; done

For example, if you have two 7zip archives a.7z and b.7z, it will create two folders a and b, and uncompress a.7z into folder a and b.7z into folder b.

The above command comes from this answer on superuser by user Vojtech.

超可爱的懒熊 2024-10-11 11:48:07

你不需要让事情变得过于复杂。要提取拆分为多个部分的 7-Zip 存档,请使用以下命令:

7z x archive.7zip.0

7-Zip 会注意到您有一个多卷存档,并且它会解压所有内容。

You do not need to overcomplicate things. To extract a 7-Zip archive split to multiply parts use the following command:

7z x archive.7zip.0

7-Zip will notice you that you have a multi-volume archive and it unpacks everything.

瑾兮 2024-10-11 11:48:07

可能最简单的方法如下

 ls | xargs -n1 7z x 

Probably the simplest approach is below

 ls | xargs -n1 7z x 
莫言歌 2024-10-11 11:48:07

除了使用 for 循环之外,

您还可以将 find 与 exec 参数或 xargs 结合使用

in adition to using a for loop

you can also use find in combination with the exec argument or xargs

Spring初心 2024-10-11 11:48:07

另一个带有 -aos 参数的示例。

# ls Environment-voice-20180629-20180705-20230706024500.zip Environment-voice-20180729-20180802-20230706050000.zip | xargs -n1 7za x -aos '-xr!/http*'

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (50657),ASM,AES-NI)

Scanning the drive for archives:
1 file, 2928050140 bytes (2793 MiB)

Extracting archive: Environment-voice-20180629-20180705-20230706024500.zip
--
Path = Environment-voice-20180629-20180705-20230706024500.zip
Type = zip
Physical Size = 2928050140
64-bit = +

Everything is Ok

Files: 631108
Size:       2664870996
Compressed: 2928050140

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (50657),ASM,AES-NI)

Scanning the drive for archives:
1 file, 2387436055 bytes (2277 MiB)

Extracting archive: Environment-voice-20180729-20180802-20230706050000.zip
--
Path = Environment-voice-20180729-20180802-20230706050000.zip
Type = zip
Physical Size = 2387436055
64-bit = +

Everything is Ok

Files: 505001
Size:       2177832150
Compressed: 2387436055


Another example with -aos parameter.

# ls Environment-voice-20180629-20180705-20230706024500.zip Environment-voice-20180729-20180802-20230706050000.zip | xargs -n1 7za x -aos '-xr!/http*'

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (50657),ASM,AES-NI)

Scanning the drive for archives:
1 file, 2928050140 bytes (2793 MiB)

Extracting archive: Environment-voice-20180629-20180705-20230706024500.zip
--
Path = Environment-voice-20180629-20180705-20230706024500.zip
Type = zip
Physical Size = 2928050140
64-bit = +

Everything is Ok

Files: 631108
Size:       2664870996
Compressed: 2928050140

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz (50657),ASM,AES-NI)

Scanning the drive for archives:
1 file, 2387436055 bytes (2277 MiB)

Extracting archive: Environment-voice-20180729-20180802-20230706050000.zip
--
Path = Environment-voice-20180729-20180802-20230706050000.zip
Type = zip
Physical Size = 2387436055
64-bit = +

Everything is Ok

Files: 505001
Size:       2177832150
Compressed: 2387436055


听闻余生 2024-10-11 11:48:07

最简单的方法是解压缩'*.zip'

确保您有 ' 标记。

The simplest way is unzip '*.zip'.

Make sure you have the ' marks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文