Php calls system commands plus compression. how can we use php to call system commands to decompress uploaded compressed files? at least, zip files can be decompressed, other items like rar or gz can be used. ------ solution ------------------ 1. tar or gzip command line tool must be installed: pack all. txt files under the current directory and compress them to the file exp.tar.gztarczvfexp.tar.gz. *. t php calls system commands plus compression
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 ');