PHP Delete Files Script
PHPI needed a script to delete all files inside a folder with certain extension, a script that could be executed with just a click. So here is how i did it:
<?
{
foreach (glob(“*.txt*”) as $fn) {
unlink($fn);
}
}
header(“Location: /1″);
?>
where *.txt is the extension im looking for delete and /1 is the directory inside im placing the script. I saved the above in a file named Delete.php and placed it inside the directory. Then I chmod’ed the entire directory with the following command:
chmod -R /var/www/1
The script works without a flaw.
Sunday, March 2nd, 2008 at 8:39 pm and is filed under PHP. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.