You are here

function _textimage_recursive_delete in Textimage 5

Same name and namespace in other branches
  1. 5.2 textimage_admin.inc \_textimage_recursive_delete()
  2. 6.2 textimage_admin.inc \_textimage_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: An absolute filepath (relative to the filesystem) to delete

2 calls to _textimage_recursive_delete()
textimage_uninstall in ./textimage.install
_textimage_preset_flush in ./textimage.module
flush cached media for a preset.

File

./textimage.module, line 1141

Code

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