Unix系统(“unzip archive.zip”)静默提取Zip文件

Unix系统(“unzip archive.zip”)静默提取Zip文件

如何静默提取文件而不显示状态?

答案1

人解压缩:

   -q     perform  operations  quietly  (-qq  = even quieter).  Ordinarily
          unzip prints the names of the files it's extracting or  testing,
          the extraction methods, any file or zipfile comments that may be
          stored in the archive, and possibly a summary when finished with
          each  archive.   The -q[q] options suppress the printing of some
          or all of these messages.

答案2

来自解压手册页

-q

安静地执行操作(-QQ= 更安静)。按说解压打印正在提取或测试的文件的名称、提取方法、可能存储在存档中的任何文件或 zip 文件注释,以及完成每个存档时可能的摘要。这-q[q] 选项禁止打印部分或全部这些消息。

确实如此unzip -qq yourfile.zip

答案3

PHP 有一个扩展

http://php.net/manual/en/book.zip.php

<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
    $zip->extractTo('/my/destination/dir/');
    $zip->close();
    echo 'ok';
} else {
    echo 'failed';
}
?>

答案4

我建议用这个枪拉链命令

gunzip /path/to/file/filename.z

这也会默默输出

相关内容