02Mar

PHP Delete Files Script

PHP

I needed a to all files inside a folder with certain extension, a that could be executed with just a click. So here is how i did it:

<?
{
foreach (glob(”*.txt*”) as $fn) {
($fn);
}
}
header(”Location: /1″);
?>

where *.txt is the extension im looking for and /1 is the directory inside im placing the . I saved the above in a file named . and placed it inside the directory. Then I chmod’ed the entire directory with the following command:

chmod -R /var/www/1

The works without a flaw.

Share This:
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Reddit
  • Digg
  • Live
  • Google
Tags: , , ,

Related posts

No comments

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.

Leave a reply