Unix system(“unzip archive.zip”) Extracting Zip Files Silently

22,212

Solution 1

man unzip:

   -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.

Solution 2

From the unzip man page:

-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.

So unzip -qq yourfile.zip it is.

Solution 3

PHP has an extension for that

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';
}
?>

Solution 4

I suggest with this is using gunzip command

gunzip /path/to/file/filename.z

this will also output silently

Share:
22,212

Related videos on Youtube

Adedoyin Akande
Author by

Adedoyin Akande

Laravel x NuxtJS x VueJS x Tailwind

Updated on September 18, 2022

Comments

  • Adedoyin Akande
    Adedoyin Akande over 1 year

    How do I silently extract files, without displaying status?

  • George Vasiliou
    George Vasiliou over 7 years
    This answer exists already
  • Shr4N
    Shr4N over 7 years
    I'm sorry, it did not when I started typing.
  • Adedoyin Akande
    Adedoyin Akande over 7 years
    Well, ZipArchive library and other libraries didn't work for my sever.
  • Michael D.
    Michael D. over 7 years
  • Adedoyin Akande
    Adedoyin Akande over 7 years
    Tried that too didn't work, had to do a unix function before it worked. Thanks Anyway