Home > Backend Development > PHP Tutorial > PHP batch modification of RAR file comment code (1/2)_PHP tutorial

PHP batch modification of RAR file comment code (1/2)_PHP tutorial

WBOY
Release: 2016-07-20 11:09:33
Original
1106 people have browsed it

Add all *.hlp files from the current folder to the compressed file help.rar

winrar a help *.hlp

To add comments from the file, you can use -z switch.
winrar c -zinfo.txt dummy

In this way, we can call cmd through the php tutorial and run the above two winrar parameters to batch modify the comments of the rar file and add the compressed file. Required Note that PHP cannot directly call cmd when the safe mode is opened.

The following code is how I read the file path through my database tutorial and finally achieve batch modification of rar file comments. .Because the database is access, I created a new odbc source. At the same time, rar.exe and cmd.exe are both in the same directory as 1.php

$id=$_get[ id];
if($id==”")
{
echo “parameter error”;
exit;
}
if($id>=400)
{
echo “all over”;
exit;
}
$db=odbc_connect(”dw”,””,””);
$sql=”select * from ` download` where `id`=$id”;
$query=odbc_exec($db,$sql);
$filename=odbc_result($query,2);
if($filename==” ")
{

}
$filename=str_replace("#1′,"",$filename);
$filename=str_replace("#2′,"",$ filename);
$filename=”soft/”.$filename;
echo $filename.”
”;
if(!file_exists($filename))
{
echo "The file does not exist, go to the next id";
                                                                                                                                                                                                        $id++; test/1.php?id=$id'>”;
exit;

}//Read the file name and check whether the file exists

else
{
`winrar a $filename Instructions for use.txt`;
echo “Inserting the description file successfully”;
$id++;
echo “”;
}
odbc_close($db);
?>



× × × × × × × × × × × × × × × × 🎜>However, at some point, the rar files we usually collect are annotated in batches. At this time, if you put these data on your own website, it is tantamount to advertising for others.
I also encountered this recently. Such a problem troubled me a lot. Later, after carefully looking through the help file of winrar, I found that we can make batch modifications through the following method.

We opened the help file of winrar, and the help file mentioned that on the command line The two parameters for modifying rar file comments and adding compressed files in mode are ac. The description file for winrar is as follows:
Add all *.hlp files from the current folder to the compressed file help.rar
winrar a help *.hlp

To add comments from a file you can use the -z switch.
winrar c -zinfo.txt dummy

1 2


http://www.bkjia.com/PHPjc/444799.html

www.bkjia.com

truehttp: //www.bkjia.com/PHPjc/444799.htmlTechArticleAdd all *.hlp files from the current folder to the compressed file help.rar winrar a help *.hlp from You can add comments to files using the -z file switch. winrar c -zinfo.txt dummy In this way, we...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template