Possible Duplicate:
How to delete a zip file using php
How can I remove zipped directory using php code?
I have a folder test. In that folder there have a zipped directory name zip_folder.
I want to remove this zipped directory from test folder. How can I do this?
I wrote some code, but its not working. This is my code:
$name = "zip_folder";
chmod('./test/'.$name.'.zip',777);
unlink('./test/'.$name.'.zip');
I got an error like this:
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: unlink(./test/zip_folder.zip) [<a href='function.unlink'>function.unlink</a>]: Permission denied</p>
<p>Filename: controllers/super_admin.php</p>
<p>Line Number: 590</p>
</div>
What is the problem in my code?
In zip_folder have subfolders also. In test folder there have zip_folder.zip and zip_folder folder. That means there have zipped copy of zip_folder and an original folder of zip_folder. I need to remove only the zipped copy of zip_folder.
Try below function for deleting folders and subfolders… You need to pass only folder path…