/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Delete files in given path (and subdirs) * * <code> echo deleteFiles('c:/TEMP/greeting/','3019*.vox' ); </code> * * @param string $path Path to the files to delete (should end with slash or backslash) * @param string $match Filename(s) to delete (use * as wildcard) * @param boolean $delSubdirs Delete matching files in subdirs * @return integer Returns how many files that were deleted */ function deleteFiles($path, $match, $delSubdirFiles = false){ static $deleted = 0; foreach ($files as $file){ $deleted++; } } if ($delSubdirFiles) { foreach ($dirs as $dir){ deleteFiles($path.$dir,$match); } } } return $deleted; }
Comments
