Quick Search:
 
 PHP Code: Delete by wildcard Jump to:  
Category: >> PHP Code >> Delete by wildcard  

<< lastnext >>

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);
}
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org