PHP Code _php Techniques for batch modification of RAR file annotations

Source: Internet
Author: User
Tags comments odbc rar safe mode
We opened the WinRAR Help file, the Help file mentioned in the command line mode to modify RAR file comments and add compressed documents two parameters are A\c,winrar the description file is as follows:
Add all *.hlp files from the current folder to the compressed file Help.rar

WinRAR a Help *.hlp

Add comments from a file to use the-z< file > switch.
WinRAR C-zinfo.txt Dummy

In this way, we can invoke cmd through PHP, run the above two WinRAR parameters to do batch modification rar file annotation and add compressed package file. It should be noted that PHP can not call cmd directly when Safe mode is open.

The following code is the way I read the file path through my database and finally implement a batch modification of the RAR file annotation. Because the database is access, I created an ODBC source. At the same time, RAR.exe and CMD.EXE are all in the 1.PHP same directory.
Copy Code code as follows:

?
$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. " <br> ";
if (!file_exists ($filename))
{
echo "File does not exist, go to next ID";
$id + +;
echo "<meta http-equiv= ' Refresh"

content= ' 0; Url=.. /test/1.php?id= $id ' > ';
Exit
}//read out the filename and check if the file exists
Else
{
' WinRAR a $filename use description. txt ';
echo "Insert description file succeeded";
$id + +;
echo "<meta http-equiv= ' Refresh ' content= ' 0; Url=.. /test/1.php?id= $id ' > ';
}
Odbc_close ($DB);
?>


Xxxxxxxxxxxxxxxxxxxx
Recent collection of popular, perhaps many friends are trying to collect data to build a rich and perfect site.
However, in some cases, we usually collect the RAR files are added in bulk annotated, this time if the data on their own station is tantamount to advertising for others.
Recently I also encountered such a problem, this is a big headache, and then carefully look at the WinRAR help file found that we can use the following methods to do batch modification.
We opened the WinRAR Help file, the Help file mentioned in the command line mode to modify RAR file comments and add compressed documents two parameters are A\c,winrar the description file is as follows:
Add all *.hlp files from the current folder to the compressed file Help.rar
WinRAR a Help *.hlp

Add comments from a file to use the-z< file > switch.
WinRAR C-zinfo.txt Dummy

In this way, we can invoke cmd through PHP, run the above two WinRAR parameters to do batch modification rar file annotation and add compressed package file. It should be noted that PHP can not call cmd directly when Safe mode is open.

The following code is the way I read the file path through my database and finally implement a batch modification of the RAR file annotation. Because the database is access, I created an ODBC source. RAR.EXE and CMD.EXE are all in the same directory in 1.PHP.
Copy Code code as follows:


?
$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. " <br> ";
if (!file_exists ($filename))
{
echo "File does not exist, go to next ID";
$id + +;
echo "<meta http-equiv= ' Refresh"

content= ' 0; Url=.. /test/1.php?id= $id ' > ';
Exit
}//read out the filename and check if the file exists
Else
{
' WinRAR a $filename use description. txt ';
echo "Insert description file succeeded";
$id + +;
echo "<meta http-equiv= ' Refresh ' content= ' 0; Url=.. /test/1.php?id= $id ' > ';
}
Odbc_close ($DB);
?>

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.