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