Re: Help with shorting this please
| From: | Curt Zirzow | Date: | Mon, 19 Apr 2004 15:16:20 +0000 |
| Subject: | Re: Help with shorting this please | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183811@lists.php.net to get a copy of this message | ||
* Thus wrote Don Myers (allmylists@comcast.net):
> PHP gurus. I know this can be made shorter but I can't seem to figure out
> how.
>
> This is a PHP CLI script I use to go through a directory listing a act upon
> file matching the same prefix and/or suffix if supplied. This is the code I
> use now.
>
> // set up the prefix and/or suffix if I want to match on certain files
> $deleteprefix = "";
> $deletesuffix = "";
>
$match = "$deleteprefix*$deletesuffix";
foreach (glob($rootpath.$match) as $file) {
logger("Deleted: ".$file." Last Modified: ".date("F j,
Y",filemtime($rootpath.$file)));
unlink($rootpath.$file);
}
Curt
--
"I used to think I was indecisive, but now I'm not so sure."