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 ');