Snippet Name: Delete by wildcard
Description: The simplest way to delete all files of a particular extension is to use the glob() function. This example will delete all '.jpg' files.
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: February 27th, 2009
|
<?PHP
FOREACH (GLOB("*.jpg") AS $filename) {
ECHO "$filename size " . FILESIZE($filename) . "\n";
UNLINK($filename);
}
?> |