How does php call system commands and compress them?

Source: Internet
Author: User
Php calls system commands plus compression. how can we use php to call system commands to decompress the uploaded compressed files? at least, we can decompress the files in zip format. other files, such as rar or gz, can be used, 1. you must install the tar or gzip command line tool: pack all. txt files in the current directory and compress them to the file exp.tar.gz t php. call the system command and compress them.
How can I use php to call system commands to decompress and upload compressed files? at least, zip files can be decompressed. other files like rar or gz can be decompressed.

------ Solution --------------------
1. the tar or gzip command line tool must be installed:
Pack all. txt files in the current directory and compress them to exp.tar.gz.
Tar czvf exp.tar.gz./*. txt
Decompress the files in this.tar.gz under the current directory to the current directory.
Tar xzvf exp.tar.gz ./
2. use php to call the command line tool:
PHP code
@ System ('tar czvf exp.tar.gz./*. txt ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.