You are here

function _imagecache_recursive_delete in ImageCache 5

Same name and namespace in other branches
  1. 5.2 imagecache.module \_imagecache_recursive_delete()
  2. 6.2 imagecache.module \_imagecache_recursive_delete()

Recursively delete all files and folders in the specified filepath, then delete the containing folder.

Note that this only deletes visible files with write permission.

Parameters

string $path: A filepath relative to file_directory_path.

1 call to _imagecache_recursive_delete()
_imagecache_preset_flush in ./imagecache.module
Flush cached media for a preset.

File

./imagecache.module, line 575
Dynamic image resizer and image cacher.

Code

function _imagecache_recursive_delete($path) {
  $listing = $path . '/*';
  foreach (glob($listing) as $file) {
    if (is_file($file) === TRUE) {
      @unlink($file);
    }
    elseif (is_dir($file) === TRUE) {
      _imagecache_recursive_delete($file);
    }
  }
  @rmdir($path);
}