如何在目标目录中递归地压缩所有文件?

use*_*856 38 gzip extract

我想知道使用什么命令来递归地将目标目录中的所有文件进行 gunzip 压缩?我尝试使用 unzip 命令,但没有用。

我尝试了从目标文件夹中解压缩所有 zip 文件的命令

hee*_*ayl 84

gunzip-r选择。来自man gunzip

   -r --recursive
          Travel  the directory structure recursively. If any of the 
file names specified on the command line are directories, gzip 
will descend into the directory and compress all the files it finds
there (or decompress them in  the  case  of gunzip ).
Run Code Online (Sandbox Code Playgroud)

因此,如果您想将目录及其所有子目录中的gunzip所有压缩文件(gunzip当前可以解压缩由 gzip、zip、compress、compress -H 或 pack 创建的文件)/foo/bar

gunzip -r /foo/bar
Run Code Online (Sandbox Code Playgroud)

这也将处理带有空格的文件名。


A.B*_*.B. 19

使用下面的命令。替换<path_of_your_zips>为 ZIP 文件的路径和<out>目标文件夹:

  • 为什么不像 `find` 那样 `-exec`。-type f -name "*.gz" -exec tar xzf {} -C &lt;out&gt; \;`? (2认同)